[STATEMENT]
lemma one_chain_line_integral_rec_join:
  assumes l_props: "set l = one_chain" "distinct l" "valid_chain_list l" and
    boundary_chain: "boundary_chain one_chain" and
    line_integral_exists: "\<forall>(k::int, \<gamma>) \<in> one_chain. line_integral_exists F basis \<gamma>" and
    valid_path: "\<forall>(k::int, \<gamma>) \<in> one_chain. valid_path \<gamma>" and
    finite_basis: "finite basis"
  shows "line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
have 0: "sum_list (map (\<lambda>((k::int), \<gamma>). (k::int) * (line_integral F basis \<gamma>)) l) = one_chain_line_integral F basis one_chain"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>) = one_chain_line_integral F basis one_chain
[PROOF STEP]
unfolding one_chain_line_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>) = (\<Sum>(k, g)\<in>one_chain. real_of_int k * line_integral F basis g)
[PROOF STEP]
using l_props Groups_List.comm_monoid_add_class.sum.distinct_set_conv_list[OF l_props(2), of "(\<lambda>(k, \<gamma>). (k::int) * (line_integral F basis \<gamma>))"]
[PROOF STATE]
proof (prove)
using this:
set l = one_chain
distinct l
valid_chain_list l
(\<Sum>(k, \<gamma>)\<in>set l. real_of_int k * line_integral F basis \<gamma>) = (\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. (\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>) = (\<Sum>(k, g)\<in>one_chain. real_of_int k * line_integral F basis g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>) = one_chain_line_integral F basis one_chain

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
have "valid_chain_list l \<Longrightarrow>
                    boundary_chain (set l) \<Longrightarrow>
                    (\<forall>(k::int, \<gamma>) \<in> set l. line_integral_exists F basis \<gamma>) \<Longrightarrow>
                    (\<forall>(k::int, \<gamma>) \<in> set l. valid_path \<gamma>) \<Longrightarrow>
                    line_integral F basis (rec_join l) = sum_list (map (\<lambda>(k::int, \<gamma>). k * (line_integral F basis \<gamma>)) l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, \<gamma>)\<in>set l. line_integral_exists F basis \<gamma>; \<forall>(k, \<gamma>)\<in>set l. valid_path \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
proof (induction l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>valid_chain_list []; boundary_chain (set []); \<forall>(k, y)\<in>set []. line_integral_exists F basis y; \<forall>(k, y)\<in>set []. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join []) = (\<Sum>(x, \<gamma>)\<leftarrow>[]. real_of_int x * line_integral F basis \<gamma>)
 2. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
valid_chain_list []
boundary_chain (set [])
\<forall>a\<in>set []. case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set []. case a of (k, a) \<Rightarrow> valid_path a

goal (2 subgoals):
 1. \<lbrakk>valid_chain_list []; boundary_chain (set []); \<forall>(k, y)\<in>set []. line_integral_exists F basis y; \<forall>(k, y)\<in>set []. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join []) = (\<Sum>(x, \<gamma>)\<leftarrow>[]. real_of_int x * line_integral F basis \<gamma>)
 2. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join []) = (\<Sum>a\<leftarrow>[]. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
unfolding line_integral_def boundary_chain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. F (rec_join [] x) \<bullet> b * (vector_derivative (rec_join []) (at x within {0..1}) \<bullet> b)) = (\<Sum>a\<leftarrow>[]. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. F (\<gamma> x) \<bullet> b * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> b)))
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
have "\<forall>x. (vector_derivative (\<lambda>x. 0) (at x)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. vector_derivative (\<lambda>x. 0::'a) (at x) = (0::'a)
[PROOF STEP]
using Derivative.vector_derivative_const_at
[PROOF STATE]
proof (prove)
using this:
vector_derivative (\<lambda>x. ?c) (at ?a) = (0::?'a)

goal (1 subgoal):
 1. \<forall>x. vector_derivative (\<lambda>x. 0::'a) (at x) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. vector_derivative (\<lambda>x. 0::?'a1) (at x) = (0::?'a1)

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. vector_derivative (\<lambda>x. 0::?'a1) (at x) = (0::?'a1)
[PROOF STEP]
have "\<forall>x. ((\<lambda>x. 0) has_vector_derivative 0) (at x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. vector_derivative (\<lambda>x. 0::?'a1) (at x) = (0::?'a1)

goal (1 subgoal):
 1. \<forall>x. ((\<lambda>x. 0::'a) has_vector_derivative (0::'a)) (at x)
[PROOF STEP]
using Derivative.vector_derivative_const_at
[PROOF STATE]
proof (prove)
using this:
\<forall>x. vector_derivative (\<lambda>x. 0::?'a1) (at x) = (0::?'a1)
vector_derivative (\<lambda>x. ?c) (at ?a) = (0::?'a)

goal (1 subgoal):
 1. \<forall>x. ((\<lambda>x. 0::'a) has_vector_derivative (0::'a)) (at x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. ((\<lambda>x. 0::?'a2) has_vector_derivative (0::?'a2)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. ((\<lambda>x. 0::?'a2) has_vector_derivative (0::?'a2)) (at x)
[PROOF STEP]
have "\<forall>x. ((\<lambda>x. 0) has_vector_derivative 0) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. ((\<lambda>x. 0::?'a2) has_vector_derivative (0::?'a2)) (at x)

goal (1 subgoal):
 1. \<forall>x. ((\<lambda>x. 0::'a) has_vector_derivative (0::'a)) (at x within {0..1})
[PROOF STEP]
using Derivative.vector_derivative_const_at
[PROOF STATE]
proof (prove)
using this:
\<forall>x. ((\<lambda>x. 0::?'a2) has_vector_derivative (0::?'a2)) (at x)
vector_derivative (\<lambda>x. ?c) (at ?a) = (0::?'a)

goal (1 subgoal):
 1. \<forall>x. ((\<lambda>x. 0::'a) has_vector_derivative (0::'a)) (at x within {0..1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. ((\<lambda>x. 0::?'a3) has_vector_derivative (0::?'a3)) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. ((\<lambda>x. 0::?'a3) has_vector_derivative (0::?'a3)) (at x within {0..1})
[PROOF STEP]
have 0: "\<forall>x\<in>{0..1}. (vector_derivative (\<lambda>x. 0) (at x within{0..1})) = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. ((\<lambda>x. 0::?'a3) has_vector_derivative (0::?'a3)) (at x within {0..1})

goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. vector_derivative (\<lambda>x. 0::'a) (at x within {0..1}) = (0::'a)
[PROOF STEP]
by (metis (no_types) box_real(2) vector_derivative_within_cbox zero_less_one)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..1}. vector_derivative (\<lambda>x. 0::?'a4) (at x within {0..1}) = (0::?'a4)

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
have "(\<forall>x\<in>{0..1}. (\<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. (\<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0
[PROOF STEP]
by (simp add: 0)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..1}. (\<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>{0..1}. (\<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0
[PROOF STEP]
show "((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1}. (\<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) = 0

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
by (meson has_integral_is_0)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>basis. F 0 \<bullet> b * (vector_derivative (\<lambda>x. 0) (at x within {0..1}) \<bullet> b)) has_integral 0) {0..1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join []) = (\<Sum>a\<leftarrow>[]. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
case ass: (Cons a l)
[PROOF STATE]
proof (state)
this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
obtain k::"int" and
      \<gamma>::"one_cube" where props: "a = (k,\<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k \<gamma>. a = (k, \<gamma>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k \<gamma>. a = (k, \<gamma>) \<Longrightarrow> thesis) \<Longrightarrow> a = (?k2, ?\<gamma>2)
[PROOF STEP]
let ?k2 = "fst a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k \<gamma>. a = (k, \<gamma>) \<Longrightarrow> thesis) \<Longrightarrow> a = (?k2, ?\<gamma>2)
[PROOF STEP]
let ?\<gamma>2 = "snd a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k \<gamma>. a = (k, \<gamma>) \<Longrightarrow> thesis) \<Longrightarrow> a = (?k2, ?\<gamma>2)
[PROOF STEP]
show "a = (?k2, ?\<gamma>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (fst a, snd a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = (fst a, snd a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a = (k, \<gamma>)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have "line_integral_exists F basis (rec_join (a # l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis (rec_join (a # l))
[PROOF STEP]
using line_integral_exists_on_rec_join[OF ass(3) ass(2)] ass(5) ass(4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k \<gamma>. (k, \<gamma>) \<in> set (a # l) \<Longrightarrow> valid_path \<gamma>; \<forall>(k, \<gamma>)\<in>set (a # l). line_integral_exists ?F ?basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (rec_join (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a

goal (1 subgoal):
 1. line_integral_exists F basis (rec_join (a # l))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis (rec_join (a # l))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have "boundary_chain (set l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boundary_chain (set l)
[PROOF STEP]
by (meson ass.prems(2) boundary_chain_def list.set_intros(2))
[PROOF STATE]
proof (state)
this:
boundary_chain (set l)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have val_l: "\<And>f i. (i,f) \<in> set l \<Longrightarrow> valid_path f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f i. (i, f) \<in> set l \<Longrightarrow> valid_path f
[PROOF STEP]
using ass.prems(4)
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a

goal (1 subgoal):
 1. \<And>f i. (i, f) \<in> set l \<Longrightarrow> valid_path f
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(?i, ?f) \<in> set l \<Longrightarrow> valid_path ?f

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have vcl_l: "valid_chain_list l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_chain_list l
[PROOF STEP]
by (metis (no_types) ass.prems(1) valid_chain_list.elims(3) valid_chain_list.simps(3))
[PROOF STATE]
proof (state)
this:
valid_chain_list l

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have line_integral_exists_on_joined:
      "line_integral_exists F basis (rec_join l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
by (metis \<open>boundary_chain (set l)\<close> \<open>line_integral_exists F basis (rec_join (a # l))\<close> emptyE val_l vcl_l joined_is_valid line_integral_exists_joinD2 line_integral_exists_on_rec_join list.set(1) neq_Nil_conv rec_join.simps(3))
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis (rec_join l)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have "valid_path (rec_join (a # l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (rec_join (a # l))
[PROOF STEP]
using joined_is_valid ass(5) ass(3) ass(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; valid_chain_list ?l\<rbrakk> \<Longrightarrow> valid_path (rec_join ?l)
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
boundary_chain (set (a # l))
valid_chain_list (a # l)

goal (1 subgoal):
 1. valid_path (rec_join (a # l))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
valid_path (rec_join (a # l))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
valid_path (rec_join (a # l))
[PROOF STEP]
have joined_is_valid: "valid_path (rec_join l)"
[PROOF STATE]
proof (prove)
using this:
valid_path (rec_join (a # l))

goal (1 subgoal):
 1. valid_path (rec_join l)
[PROOF STEP]
using \<open>boundary_chain (set l)\<close> val_l vcl_l joined_is_valid
[PROOF STATE]
proof (prove)
using this:
valid_path (rec_join (a # l))
boundary_chain (set l)
(?i, ?f) \<in> set l \<Longrightarrow> valid_path ?f
valid_chain_list l
\<lbrakk>boundary_chain (set ?l); \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; valid_chain_list ?l\<rbrakk> \<Longrightarrow> valid_path (rec_join ?l)

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

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, y)\<in>set l. line_integral_exists F basis y; \<forall>(k, y)\<in>set l. valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>); valid_chain_list (a # l); boundary_chain (set (a # l)); \<forall>(k, y)\<in>set (a # l). line_integral_exists F basis y; \<forall>(k, y)\<in>set (a # l). valid_path y\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (\<Sum>(x, \<gamma>)\<leftarrow>a # l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join (a # l)) = (\<Sum>a\<leftarrow>a # l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
proof (clarsimp, cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
 2. \<not> ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
assume k_eq_1: "(k::int) = 1"
[PROOF STATE]
proof (state)
this:
k = 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
 2. \<not> ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have line_integral_exists_on_gamma: "line_integral_exists F basis \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
using ass props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis \<gamma>

goal (2 subgoals):
 1. ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
 2. \<not> ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have gamma_is_valid: "valid_path \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path \<gamma>
[PROOF STEP]
using ass props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

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

goal (2 subgoals):
 1. ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
 2. \<not> ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have line_int_rw: "line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
have gam_int: "line_integral_exists F basis \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
using ass props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis \<gamma>

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
have rec_join_int: "line_integral_exists F basis (rec_join l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
using line_integral_exists_on_rec_join
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); valid_chain_list ?l; \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; \<forall>(k, \<gamma>)\<in>set ?l. line_integral_exists ?F ?basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (rec_join ?l)

goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
using line_integral_exists_on_joined
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); valid_chain_list ?l; \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; \<forall>(k, \<gamma>)\<in>set ?l. line_integral_exists ?F ?basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (rec_join ?l)
line_integral_exists F basis (rec_join l)

goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis (rec_join l)

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
using line_integral_rec_join_cons[OF gam_int rec_join_int] ass k_eq_1 finite_basis props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k' \<gamma>'. (k', \<gamma>') \<in> set ((1, \<gamma>) # l) \<Longrightarrow> valid_path \<gamma>'; finite basis\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join ((1, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
k = 1
finite basis
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (\<gamma> +++ rec_join l)

goal (2 subgoals):
 1. ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
 2. \<not> ?P \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
show "line_integral F basis (rec_join (a # l)) =
            (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
apply (simp add: props line_int_rw)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (\<gamma> +++ rec_join l) = real_of_int k * line_integral F basis \<gamma> + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
using line_integral_distrib[OF line_integral_exists_on_gamma line_integral_exists_on_joined gamma_is_valid joined_is_valid]
          ass k_eq_1 vcl_l
[PROOF STATE]
proof (prove)
using this:
line_integral F basis (\<gamma> +++ rec_join l) = line_integral F basis \<gamma> + line_integral F basis (rec_join l)
line_integral_exists F basis (\<gamma> +++ rec_join l)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
k = 1
valid_chain_list l

goal (1 subgoal):
 1. line_integral F basis (\<gamma> +++ rec_join l) = real_of_int k * line_integral F basis \<gamma> + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
by (auto simp: boundary_chain_def props)
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
assume "k \<noteq> 1"
[PROOF STATE]
proof (state)
this:
k \<noteq> 1

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 1
[PROOF STEP]
have k_eq_neg_1: "k = -1"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 1

goal (1 subgoal):
 1. k = - 1
[PROOF STEP]
using ass props
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 1
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. k = - 1
[PROOF STEP]
by (auto simp add: boundary_chain_def)
[PROOF STATE]
proof (state)
this:
k = - 1

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have line_integral_exists_on_gamma:
        "line_integral_exists F basis (reversepath \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis (reversepath \<gamma>)
[PROOF STEP]
using line_integral_on_reverse_path ass props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_path ?\<gamma>; line_integral_exists ?F ?basis ?\<gamma>\<rbrakk> \<Longrightarrow> line_integral ?F ?basis ?\<gamma> = - line_integral ?F ?basis (reversepath ?\<gamma>)
\<lbrakk>valid_path ?\<gamma>; line_integral_exists ?F ?basis ?\<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (reversepath ?\<gamma>)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral_exists F basis (reversepath \<gamma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis (reversepath \<gamma>)

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have gamma_is_valid: "valid_path (reversepath \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (reversepath \<gamma>)
[PROOF STEP]
using valid_path_imp_reverse ass props
[PROOF STATE]
proof (prove)
using this:
valid_path ?g \<Longrightarrow> valid_path (reversepath ?g)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. valid_path (reversepath \<gamma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
valid_path (reversepath \<gamma>)

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have line_int_rw: "line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis ((reversepath \<gamma>) +++ rec_join l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
have gam_int: "line_integral_exists F basis \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
using ass props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis \<gamma>

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
have rec_join_int: "line_integral_exists F basis (rec_join l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
using line_integral_exists_on_rec_join
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); valid_chain_list ?l; \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; \<forall>(k, \<gamma>)\<in>set ?l. line_integral_exists ?F ?basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (rec_join ?l)

goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
using line_integral_exists_on_joined
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); valid_chain_list ?l; \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; \<forall>(k, \<gamma>)\<in>set ?l. line_integral_exists ?F ?basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral_exists ?F ?basis (rec_join ?l)
line_integral_exists F basis (rec_join l)

goal (1 subgoal):
 1. line_integral_exists F basis (rec_join l)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
line_integral_exists F basis (rec_join l)

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
using line_integral_rec_join_cons_2[OF gam_int rec_join_int]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k' \<gamma>'. (k', \<gamma>') \<in> set ((- 1, \<gamma>) # l) \<Longrightarrow> valid_path \<gamma>'; finite basis\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join ((- 1, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
using ass k_eq_neg_1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k' \<gamma>'. (k', \<gamma>') \<in> set ((- 1, \<gamma>) # l) \<Longrightarrow> valid_path \<gamma>'; finite basis\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join ((- 1, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
k = - 1

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
using finite_basis props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k' \<gamma>'. (k', \<gamma>') \<in> set ((- 1, \<gamma>) # l) \<Longrightarrow> valid_path \<gamma>'; finite basis\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join ((- 1, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
k = - 1
finite basis
a = (k, \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join ((k, \<gamma>) # l)) = line_integral F basis (reversepath \<gamma> +++ rec_join l)

goal (1 subgoal):
 1. k \<noteq> 1 \<Longrightarrow> line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
show "line_integral F basis (rec_join (a # l)) =
            (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
apply (simp add: props line_int_rw)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F basis (reversepath \<gamma> +++ rec_join l) = real_of_int k * line_integral F basis \<gamma> + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
using line_integral_distrib[OF line_integral_exists_on_gamma line_integral_exists_on_joined gamma_is_valid joined_is_valid]
          props ass line_integral_on_reverse_path(1)[of "\<gamma>" "F" "basis"] k_eq_neg_1
[PROOF STATE]
proof (prove)
using this:
line_integral F basis (reversepath \<gamma> +++ rec_join l) = line_integral F basis (reversepath \<gamma>) + line_integral F basis (rec_join l)
line_integral_exists F basis (reversepath \<gamma> +++ rec_join l)
a = (k, \<gamma>)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
\<lbrakk>valid_path \<gamma>; line_integral_exists F basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis \<gamma> = - line_integral F basis (reversepath \<gamma>)
k = - 1

goal (1 subgoal):
 1. line_integral F basis (reversepath \<gamma> +++ rec_join l) = real_of_int k * line_integral F basis \<gamma> + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
using \<open>boundary_chain (set l)\<close> vcl_l
[PROOF STATE]
proof (prove)
using this:
line_integral F basis (reversepath \<gamma> +++ rec_join l) = line_integral F basis (reversepath \<gamma>) + line_integral F basis (rec_join l)
line_integral_exists F basis (reversepath \<gamma> +++ rec_join l)
a = (k, \<gamma>)
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> line_integral_exists F basis a; \<forall>a\<in>set l. case a of (k, a) \<Rightarrow> valid_path a\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>a\<leftarrow>l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)
valid_chain_list (a # l)
boundary_chain (set (a # l))
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> line_integral_exists F basis a
\<forall>a\<in>set (a # l). case a of (k, a) \<Rightarrow> valid_path a
\<lbrakk>valid_path \<gamma>; line_integral_exists F basis \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis \<gamma> = - line_integral F basis (reversepath \<gamma>)
k = - 1
boundary_chain (set l)
valid_chain_list l

goal (1 subgoal):
 1. line_integral F basis (reversepath \<gamma> +++ rec_join l) = real_of_int k * line_integral F basis \<gamma> + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join (a # l)) = (case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>) + (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join (a # l)) = (\<Sum>a\<leftarrow>a # l. case a of (x, \<gamma>) \<Rightarrow> real_of_int x * line_integral F basis \<gamma>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, \<gamma>)\<in>set l. line_integral_exists F basis \<gamma>; \<forall>(k, \<gamma>)\<in>set l. valid_path \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, \<gamma>)\<in>set l. line_integral_exists F basis \<gamma>; \<forall>(k, \<gamma>)\<in>set l. valid_path \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
have 1:"line_integral F basis (rec_join l) = sum_list (map (\<lambda>(k::int, \<gamma>). k * (line_integral F basis \<gamma>)) l)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, \<gamma>)\<in>set l. line_integral_exists F basis \<gamma>; \<forall>(k, \<gamma>)\<in>set l. valid_path \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
using l_props assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_chain_list l; boundary_chain (set l); \<forall>(k, \<gamma>)\<in>set l. line_integral_exists F basis \<gamma>; \<forall>(k, \<gamma>)\<in>set l. valid_path \<gamma>\<rbrakk> \<Longrightarrow> line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
set l = one_chain
distinct l
valid_chain_list l
set l = one_chain
distinct l
valid_chain_list l
boundary_chain one_chain
\<forall>(k, \<gamma>)\<in>one_chain. line_integral_exists F basis \<gamma>
\<forall>(k, \<gamma>)\<in>one_chain. valid_path \<gamma>
finite basis

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
using 0 1
[PROOF STATE]
proof (prove)
using this:
line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)
(\<Sum>(k, \<gamma>)\<leftarrow>l. real_of_int k * line_integral F basis \<gamma>) = one_chain_line_integral F basis one_chain
line_integral F basis (rec_join l) = (\<Sum>(x, \<gamma>)\<leftarrow>l. real_of_int x * line_integral F basis \<gamma>)

goal (1 subgoal):
 1. line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral F basis (rec_join l) = one_chain_line_integral F basis one_chain

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_ge_n_over_k_pow_k: "k \<le> n \<Longrightarrow> (of_nat n / of_nat k :: 'a) ^ k \<le> of_nat (n choose k)"
  for k n :: nat and x :: "'a::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> n \<Longrightarrow> (of_nat n / of_nat k) ^ k \<le> of_nat (n choose k)
[PROOF STEP]
by (simp add: gbinomial_ge_n_over_k_pow_k binomial_gbinomial of_nat_diff)


[STATEMENT]
lemma gauss_sum_nat2: "(\<Sum>i< (n :: nat). i) = (n - 1) * n div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
hence id: "{..<n} = {0..m}"
[PROOF STATE]
proof (prove)
using this:
n = Suc m

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

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {0..m} = (n - 1) * n div 2
[PROOF STEP]
unfolding gauss_sum_nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * Suc m div 2 = (n - 1) * n div 2
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * Suc m div 2 = (Suc m - 1) * Suc m div 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Sum> {..<n} = (n - 1) * n div 2

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> \<Sum> {..<n} = (n - 1) * n div 2
[PROOF STEP]
qed auto


[STATEMENT]
lemma summatory_divisor_eq:
  "sum_upto (\<lambda>n. real (divisor_count n)) (real m) = card {(n,d). n \<in> {0<..m} \<and> d dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
have "sum_upto (\<lambda>n. real (divisor_count n)) m = card (SIGMA n:{0<..m}. {d. d dvd n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card (SIGMA n:{0<..m}. {d. d dvd n}))
[PROOF STEP]
unfolding sum_upto_altdef divisor_count_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{0<..nat \<lfloor>real m\<rfloor>}. real (card {d. d dvd n})) = real (card (SIGMA n:{0<..m}. {d. d dvd n}))
[PROOF STEP]
by (subst card_SigmaI) simp_all
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card (SIGMA n:{0<..m}. {d. d dvd n}))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card (SIGMA n:{0<..m}. {d. d dvd n}))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
have "(SIGMA n:{0<..m}. {d. d dvd n}) = {(n,d). n \<in> {0<..m} \<and> d dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SIGMA n:{0<..m}. {d. d dvd n}) = {(n, d). n \<in> {0<..m} \<and> d dvd n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(SIGMA n:{0<..m}. {d. d dvd n}) = {(n, d). n \<in> {0<..m} \<and> d dvd n}

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) (real m) = real (card {(n, d). n \<in> {0<..m} \<and> d dvd n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor_mat_is_assoc:
  fixes A B C:: "complex Matrix.mat"
  shows "A \<Otimes> (B \<Otimes> C) = (A \<Otimes> B) \<Otimes> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
define M where d:"M = mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))"
[PROOF STATE]
proof (state)
this:
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))
[PROOF STEP]
have "B \<Otimes> C = M"
[PROOF STATE]
proof (prove)
using this:
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))

goal (1 subgoal):
 1. B \<Otimes> C = M
[PROOF STEP]
using tensor_mat_def
[PROOF STATE]
proof (prove)
using this:
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))
?A \<Otimes> ?B \<equiv> Tensor.mat_of_cols_list (dim_row ?A * dim_row ?B) (mult.Tensor (*) (mat_to_cols_list ?A) (mat_to_cols_list ?B))

goal (1 subgoal):
 1. B \<Otimes> C = M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B \<Otimes> C = M

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
B \<Otimes> C = M

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
have "A \<Otimes> (B \<Otimes> C) = mat_of_cols_list (dim_row A * (dim_row B * dim_row C))
(mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))
[PROOF STEP]
using tensor_mat_def d dim_row_tensor_mat
[PROOF STATE]
proof (prove)
using this:
?A \<Otimes> ?B \<equiv> Tensor.mat_of_cols_list (dim_row ?A * dim_row ?B) (mult.Tensor (*) (mat_to_cols_list ?A) (mat_to_cols_list ?B))
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))
dim_row (?A \<Otimes> ?B) = dim_row ?A * dim_row ?B

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
have "mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)
[PROOF STEP]
using d list_to_mat_to_cols_list
[PROOF STATE]
proof (prove)
using this:
M = Tensor.mat_of_cols_list (dim_row B * dim_row C) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))
Matrix_Legacy.mat ?nr ?nc ?l \<Longrightarrow> mat_to_cols_list (Tensor.mat_of_cols_list ?nr ?l) = ?l

goal (1 subgoal):
 1. mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)
[PROOF STEP]
by (smt calculation(1) dim_col_tensor_mat length_greater_0_conv length_mat_to_cols_list mat_to_cols_list_is_mat
mult.Tensor.simps(1) mult.Tensor_null mult.well_defined_Tensor nat_0_less_mult_iff plus_mult_cpx plus_mult_def row_length_mat_to_cols_list)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
B \<Otimes> C = M
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))
mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)
[PROOF STEP]
have "A \<Otimes> (B \<Otimes> C) = mat_of_cols_list (dim_row A * (dim_row B * dim_row C))
(mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))"
[PROOF STATE]
proof (prove)
using this:
B \<Otimes> C = M
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list M))
mat_to_cols_list M = mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
have "\<dots> = mat_of_cols_list ((dim_row A * dim_row B) * dim_row C)
(mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))
[PROOF STEP]
using Matrix_Tensor.mult.associativity
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Matrix_Tensor.mult ?id ?f; Matrix_Legacy.mat (mult.row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> Matrix_Legacy.mat (mult.row_length ?M2.0) (length ?M2.0) ?M2.0 \<and> Matrix_Legacy.mat (mult.row_length ?M3.0) (length ?M3.0) ?M3.0\<rbrakk> \<Longrightarrow> mult.Tensor ?f ?M1.0 (mult.Tensor ?f ?M2.0 ?M3.0) = mult.Tensor ?f (mult.Tensor ?f ?M1.0 ?M2.0) ?M3.0

goal (1 subgoal):
 1. Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))
[PROOF STEP]
by (smt ab_semigroup_mult_class.mult_ac(1) length_greater_0_conv length_mat_to_cols_list
mat_to_cols_list_is_mat mult.Tensor.simps(1) mult.Tensor_null plus_mult_cpx plus_mult_def)
[PROOF STATE]
proof (state)
this:
Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))
Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))
Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
using tensor_mat_def
[PROOF STATE]
proof (prove)
using this:
A \<Otimes> (B \<Otimes> C) = Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C)))
Tensor.mat_of_cols_list (dim_row A * (dim_row B * dim_row C)) (mult.Tensor (*) (mat_to_cols_list A) (mult.Tensor (*) (mat_to_cols_list B) (mat_to_cols_list C))) = Tensor.mat_of_cols_list (dim_row A * dim_row B * dim_row C) (mult.Tensor (*) (mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B)) (mat_to_cols_list C))
?A \<Otimes> ?B \<equiv> Tensor.mat_of_cols_list (dim_row ?A * dim_row ?B) (mult.Tensor (*) (mat_to_cols_list ?A) (mat_to_cols_list ?B))

goal (1 subgoal):
 1. A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C
[PROOF STEP]
by (smt Tensor.mat_of_cols_list_def dim_col_mat(1) dim_col_tensor_mat dim_row_tensor_mat length_0_conv
list_to_mat_to_cols_list mat_to_cols_list_is_mat mult.well_defined_Tensor mult_is_0 neq0_conv
plus_mult_cpx plus_mult_def row_length_mat_to_cols_list)
[PROOF STATE]
proof (state)
this:
A \<Otimes> (B \<Otimes> C) = A \<Otimes> B \<Otimes> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat1_vert_block:
       "rat_poly.matrix_mult
                   (blockmat b)
                   (blockmat (make_vert_block (nat (codomain_block b))))
                           = (blockmat b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
have "mat
          (rat_poly.row_length (blockmat b))
          (2^(nat (codomain_block b)))
                            (blockmat b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)
[PROOF STEP]
using  length_codomain_block matrix_blockmat
[PROOF STATE]
proof (prove)
using this:
length (blockmat ?ls) = 2 ^ nat (codomain_block ?ls)
mat (rat_poly.row_length (blockmat ?ls)) (length (blockmat ?ls)) (blockmat ?ls)

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
have "(blockmat (make_vert_block (nat (codomain_block b))))
                       = mat1 (2^(nat (codomain_block b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))
[PROOF STEP]
using make_vert_block_map_blockmat
[PROOF STATE]
proof (prove)
using this:
blockmat (make_vert_block ?n) = mat1 (2 ^ ?n)

goal (1 subgoal):
 1. blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)
blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)
blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
using mat1_rt_mult
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat b)) (2 ^ nat (codomain_block b)) (blockmat b)
blockmat (make_vert_block (nat (codomain_block b))) = mat1 (2 ^ nat (codomain_block b))
mat ?nr ?nc ?m1.0 \<Longrightarrow> rat_poly.matrix_mult ?m1.0 (mat1 ?nc) = ?m1.0

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult (blockmat b) (blockmat (make_vert_block (nat (codomain_block b)))) = blockmat b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccInf_union_distrib: "countable A \<Longrightarrow> countable B \<Longrightarrow> Inf (A \<union> B) = inf (Inf A) (Inf B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; countable B\<rbrakk> \<Longrightarrow> Inf (A \<union> B) = inf (Inf A) (Inf B)
[PROOF STEP]
by (rule order.antisym) (auto intro: ccInf_greatest ccInf_lower le_infI1 le_infI2)


[STATEMENT]
lemma card_number_partitions_with_only_parts_1_eq_1:
  assumes "n \<le> x"
  shows "card {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1" (is "card ?N = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1
[PROOF STEP]
have "\<forall>N \<in> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N}. size N = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N}. size N = n
[PROOF STEP]
unfolding number_partition1_eq_replicate_mset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>N\<in>{replicate_mset n 1}. size N = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N}. size N = n

goal (1 subgoal):
 1. card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1
[PROOF STEP]
from this number_partition1_eq_replicate_mset \<open>n \<le> x\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N}. size N = n
{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition ?n N} = {replicate_mset ?n 1}
n \<le> x
[PROOF STEP]
have "?N = {replicate_mset n 1}"
[PROOF STATE]
proof (prove)
using this:
\<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N}. size N = n
{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition ?n N} = {replicate_mset ?n 1}
n \<le> x

goal (1 subgoal):
 1. {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = {replicate_mset n 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = {replicate_mset n 1}

goal (1 subgoal):
 1. card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = {replicate_mset n 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = {replicate_mset n 1}

goal (1 subgoal):
 1. card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition n N \<and> size N \<le> x} = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_listrel1_eq_len: "(x,y) \<in> (listrel1 r)\<^sup>* \<Longrightarrow> length x = length y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> (listrel1 r)\<^sup>* \<Longrightarrow> length x = length y
[PROOF STEP]
by (induct rule: rtrancl.induct) (auto intro: listrel1_eq_len)


[STATEMENT]
lemma list_all2_rel_prod_fst_last:
  assumes "list_all2 (rel_prod R1 R2) xs ys" and "xs \<noteq> [] \<or> ys \<noteq> []"
  shows "R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
have "xs \<noteq> []" and "ys \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] &&& ys \<noteq> []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod R1 R2) xs ys
xs \<noteq> [] \<or> ys \<noteq> []

goal (1 subgoal):
 1. xs \<noteq> [] &&& ys \<noteq> []
[PROOF STEP]
by (auto elim: list.rel_cases)
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
ys \<noteq> []

goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
ys \<noteq> []

goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
have "length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
by (rule assms(1)[THEN list_all2_lengthD])
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
ys \<noteq> []
length xs = length ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
ys \<noteq> []
length xs = length ys

goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
using list_all2_rel_prod_nth[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
ys \<noteq> []
length xs = length ys
?n < length xs \<Longrightarrow> R1 (fst (xs ! ?n)) (fst (ys ! ?n)) \<and> R2 (snd (xs ! ?n)) (snd (ys ! ?n))

goal (1 subgoal):
 1. R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))
[PROOF STEP]
by (simp add: last_conv_nth)
[PROOF STATE]
proof (state)
this:
R1 (fst (last xs)) (fst (last ys)) \<and> R2 (snd (last xs)) (snd (last ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bitset_sum:
  assumes "finite B"
  shows "bitset (\<Sum>i\<in>B. 2 ^ i) = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitset (sum ((^) 2) B) = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. bitset (sum ((^) 2) B) = B
[PROOF STEP]
unfolding bitset_def
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. {i. odd (sum ((^) 2) B div 2 ^ i)} = B
[PROOF STEP]
by (simp add: binarysum_div odd_iff)


[STATEMENT]
lemma list_length_iff_distinct:
  "\<lbrakk>set xs = set ys; distinct ys\<rbrakk> \<Longrightarrow> distinct xs \<longleftrightarrow> length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs = set ys; distinct ys\<rbrakk> \<Longrightarrow> distinct xs = (length xs = length ys)
[PROOF STEP]
by (metis distinct_card card_distinct)


[STATEMENT]
lemma vector_derivative_circlepath01:
    "\<lbrakk>0 \<le> x; x \<le> 1\<rbrakk>
     \<Longrightarrow> vector_derivative (circlepath z r) (at x within {0..1}) =
          2 * pi * \<i> * r * exp(2 * of_real pi * \<i> * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> vector_derivative (circlepath z r) (at x within {0..1}) = complex_of_real (2 * pi) * \<i> * complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real x)
[PROOF STEP]
using has_vector_derivative_circlepath
[PROOF STATE]
proof (prove)
using this:
(circlepath ?z ?r has_vector_derivative complex_of_real (2 * pi) * \<i> * complex_of_real ?r * exp (2 * complex_of_real pi * \<i> * complex_of_real ?x)) (at ?x within ?X)

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> vector_derivative (circlepath z r) (at x within {0..1}) = complex_of_real (2 * pi) * \<i> * complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real x)
[PROOF STEP]
by (auto simp: vector_derivative_at_within_ivl)


[STATEMENT]
lemma is_rcoset_replist_Cons :
  "is_rcoset_replist H (g#gs) \<longleftrightarrow>
      g \<in> G \<and> set gs \<subseteq> G
    \<and> (rcoset_rel H)``{g} \<notin> set (map (\<lambda>x. (rcoset_rel H)``{x}) gs)
    \<and> distinct (map (\<lambda>x. (rcoset_rel H)``{x}) gs)
    \<and> G = (rcoset_rel H)``{g} \<union> (\<Union>x\<in>set gs. (rcoset_rel H)``{x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_rcoset_replist H (g # gs) = (g \<in> G \<and> set gs \<subseteq> G \<and> rcoset_rel H `` {g} \<notin> set (map (\<lambda>x. rcoset_rel H `` {x}) gs) \<and> distinct (map (\<lambda>x. rcoset_rel H `` {x}) gs) \<and> G = rcoset_rel H `` {g} \<union> (\<Union>x\<in>set gs. rcoset_rel H `` {x}))
[PROOF STEP]
using is_rcoset_replist_def[of H "g#gs"]
[PROOF STATE]
proof (prove)
using this:
is_rcoset_replist H (g # gs) \<equiv> set (g # gs) \<subseteq> G \<and> distinct (map (\<lambda>g. rcoset_rel H `` {g}) (g # gs)) \<and> G = (\<Union>g\<in>set (g # gs). rcoset_rel H `` {g})

goal (1 subgoal):
 1. is_rcoset_replist H (g # gs) = (g \<in> G \<and> set gs \<subseteq> G \<and> rcoset_rel H `` {g} \<notin> set (map (\<lambda>x. rcoset_rel H `` {x}) gs) \<and> distinct (map (\<lambda>x. rcoset_rel H `` {x}) gs) \<and> G = rcoset_rel H `` {g} \<union> (\<Union>x\<in>set gs. rcoset_rel H `` {x}))
[PROOF STEP]
by auto


[STATEMENT]
lemma universal_lookup_sem_R:
  assumes "\<And>i. i \<in> set_fml fml \<Longrightarrow> i < length qs"
  assumes "set signs = consistent_sign_vectors_R qs UNIV"
  shows "(\<forall>x::real. lookup_sem fml (map (\<lambda>p. poly p x) qs)) \<longleftrightarrow>
    list_all (lookup_sem fml) signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. lookup_sem fml (map (\<lambda>p. poly p x) qs)) = list_all (lookup_sem fml) signs
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
set signs = consistent_sign_vectors_R qs UNIV

goal (1 subgoal):
 1. (\<forall>x. lookup_sem fml (map (\<lambda>p. poly p x) qs)) = list_all (lookup_sem fml) signs
[PROOF STEP]
unfolding consistent_sign_vectors_R_def list_all_iff
[PROOF STATE]
proof (prove)
using this:
set signs = range (consistent_sign_vec qs)

goal (1 subgoal):
 1. (\<forall>x. lookup_sem fml (map (\<lambda>p. poly p x) qs)) = Ball (set signs) (lookup_sem fml)
[PROOF STEP]
by (simp add: assms(1) consistent_sign_vec_semantics_R)


[STATEMENT]
lemma homotopic_from_contractible:
  fixes S :: "'a::real_normed_vector set" and T:: "'b::real_normed_vector set"
  assumes f: "continuous_on S f" "f ` S \<subseteq> T"
      and g: "continuous_on S g" "g ` S \<subseteq> T"
      and "contractible S" "path_connected T"
    shows "homotopic_with_canon (\<lambda>h. True) S T f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) S T f g
[PROOF STEP]
using homotopic_through_contractible [of S id S f T id g]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on S id; id ` S \<subseteq> S; continuous_on S f; f ` S \<subseteq> T; continuous_on S id; id ` S \<subseteq> S; continuous_on S g; g ` S \<subseteq> T; contractible S; path_connected T\<rbrakk> \<Longrightarrow> homotopic_with_canon (\<lambda>h. True) S T (f \<circ> id) (g \<circ> id)

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) S T f g
[PROOF STEP]
by (simp add: assms contractible_imp_path_connected)


[STATEMENT]
lemma iadd_is_0: "(m + n = (0::enat)) = (m = 0 \<and> n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m + n = 0) = (m = 0 \<and> n = 0)
[PROOF STEP]
by (rule add_eq_0_iff_both_eq_0)


[STATEMENT]
lemma hull_Un:
  assumes T: "\<And>T. Ball T S \<Longrightarrow> S (\<Inter>T)"
  shows "S hull (s \<union> t) = S hull (S hull s \<union> S hull t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S hull (s \<union> t) = S hull (S hull s \<union> S hull t)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S hull (s \<union> t) \<subseteq> S hull (S hull s \<union> S hull t)
 2. S hull (S hull s \<union> S hull t) \<subseteq> S hull (s \<union> t)
[PROOF STEP]
apply (meson hull_mono hull_subset sup.mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S hull (S hull s \<union> S hull t) \<subseteq> S hull (s \<union> t)
[PROOF STEP]
by (metis hull_Un_subset hull_hull hull_mono)


[STATEMENT]
lemma negate_wf_dfa: "wf_dfa (negate_dfa A) l = wf_dfa A l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dfa (negate_dfa A) l = wf_dfa A l
[PROOF STEP]
by (simp add: negate_dfa_def wf_dfa_def dfa_is_node_def split_beta)


[STATEMENT]
lemma pochhammer_poly_Suc: "pochhammer_poly (Suc n) = [:of_nat n,1:] * pochhammer_poly n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer_poly (Suc n) = [:of_nat n, 1::'a:] * pochhammer_poly n
[PROOF STEP]
by (cases "n = 0") (simp_all add: poly_eq_iff coeff_pochhammer_poly coeff_pCons split: nat.split)


[STATEMENT]
lemma bezout_gcd_nat':
  fixes a b :: nat
  shows "\<exists>x y. b * y \<le> a * x \<and> a * x - b * y = gcd a b \<or> a * y \<le> b * x \<and> b * x - a * y = gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. b * y \<le> a * x \<and> a * x - b * y = gcd a b \<or> a * y \<le> b * x \<and> b * x - a * y = gcd a b
[PROOF STEP]
using bezout_nat[of a b]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<Longrightarrow> \<exists>x y. a * x = b * y + gcd a b

goal (1 subgoal):
 1. \<exists>x y. b * y \<le> a * x \<and> a * x - b * y = gcd a b \<or> a * y \<le> b * x \<and> b * x - a * y = gcd a b
[PROOF STEP]
by (metis add_diff_cancel_left' diff_zero gcd.commute gcd_0_nat
            le_add_same_cancel1 mult.right_neutral zero_le)


[STATEMENT]
lemma cofactor_transpose: "cofactor (transpose A) = transpose (cofactor A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cofactor (Square_Matrix.transpose A) = Square_Matrix.transpose (cofactor A)
[PROOF STEP]
by (simp add: cofactor_def minor_transpose det_transpose transpose.rep_eq to_fun_inject[symmetric] of_fun_inverse)


[STATEMENT]
lemma image_mset_eq_plus_image_msetD:
  "image_mset f A = B + image_mset f C \<Longrightarrow> inj_on f (set_mset A \<union> set_mset C) \<Longrightarrow>
  \<exists>B'. A = B' + C \<and> B = image_mset f B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>image_mset f A = B + image_mset f C; inj_on f (set_mset A \<union> set_mset C)\<rbrakk> \<Longrightarrow> \<exists>B'. A = B' + C \<and> B = image_mset f B'
[PROOF STEP]
unfolding add.commute[of B] add.commute[of _ C]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>image_mset f A = image_mset f C + B; inj_on f (set_mset A \<union> set_mset C)\<rbrakk> \<Longrightarrow> \<exists>B'. A = C + B' \<and> B = image_mset f B'
[PROOF STEP]
by (rule image_mset_eq_image_mset_plusD; assumption)


[STATEMENT]
lemma bitset_Suc:
  assumes "even n"
  shows "bitset (n + 1) = insert 0 (bitset n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitset (n + 1) = insert 0 (bitset n)
[PROOF STEP]
proof (rule set_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> bitset (n + 1)) = (x \<in> insert 0 (bitset n))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> bitset (n + 1)) = (x \<in> insert 0 (bitset n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
even n
[PROOF STEP]
show "(x \<in> bitset (n + 1)) = (x \<in> insert 0 (bitset n))"
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. (x \<in> bitset (n + 1)) = (x \<in> insert 0 (bitset n))
[PROOF STEP]
unfolding bitset_def
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. (x \<in> {i. odd ((n + 1) div 2 ^ i)}) = (x \<in> insert 0 {i. odd (n div 2 ^ i)})
[PROOF STEP]
by (cases x) (auto simp add: Divides.div_mult2_eq)
[PROOF STATE]
proof (state)
this:
(x \<in> bitset (n + 1)) = (x \<in> insert 0 (bitset n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f1_l0: assumes "l0 \<le> l/c" shows "f1*(l/c) \<le> f1*l - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
have "1 = f1*((c-1)/c)*(c*(1/(f1*(c-1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = f1 * ((c - 1) / c) * (c * (1 / (f1 * (c - 1))))
[PROOF STEP]
by(simp add: field_simps)
[PROOF STATE]
proof (state)
this:
1 = f1 * ((c - 1) / c) * (c * (1 / (f1 * (c - 1))))

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 = f1 * ((c - 1) / c) * (c * (1 / (f1 * (c - 1))))

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
note l0f1c
[PROOF STATE]
proof (state)
this:
1 / (f1 * (c - 1)) \<le> l0

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / (f1 * (c - 1)) \<le> l0

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
note assms(1)
[PROOF STATE]
proof (state)
this:
l0 \<le> l / c

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> f1 * ((c - 1) / c) * (c * x) \<le> f1 * ((c - 1) / c) * (c * y); \<And>x y. x \<le> y \<Longrightarrow> f1 * ((c - 1) / c) * (c * x) \<le> f1 * ((c - 1) / c) * (c * y)\<rbrakk> \<Longrightarrow> 1 \<le> f1 * ((c - 1) / c) * (c * (l / c))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> f1 * ((c - 1) / c) * (c * x) \<le> f1 * ((c - 1) / c) * (c * y); \<And>x y. x \<le> y \<Longrightarrow> f1 * ((c - 1) / c) * (c * x) \<le> f1 * ((c - 1) / c) * (c * y)\<rbrakk> \<Longrightarrow> 1 \<le> f1 * ((c - 1) / c) * (c * (l / c))

goal (1 subgoal):
 1. f1 * (l / c) \<le> f1 * l - 1
[PROOF STEP]
by(simp add: divide_le_cancel) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
f1 * (l / c) \<le> f1 * l - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem c_tl_is_pr: "c_tl \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
have "c_tl = (\<lambda> u. (sgn1 ((c_len u) - 1))*((c_pair (c_len u - (2::nat)) (c_snd (c_snd (u-(1::nat))))) + 1))" (is "_ = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_tl = (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1))
[PROOF STEP]
by (simp add: c_tl_aux3 ext)
[PROOF STATE]
proof (state)
this:
c_tl = (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1))

goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c_tl = (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1))

goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
from c_len_is_pr c_pair_is_pr
[PROOF STATE]
proof (chain)
picking this:
c_len \<in> PrimRec1
c_pair \<in> PrimRec2
[PROOF STEP]
have "?R \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
c_len \<in> PrimRec1
c_pair \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1)) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1)) \<in> PrimRec1

goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c_tl = (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1))
(\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1)) \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_tl = (\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1))
(\<lambda>u. sgn1 (c_len u - 1) * (c_pair (c_len u - 2) (c_snd (c_snd (u - 1))) + 1)) \<in> PrimRec1

goal (1 subgoal):
 1. c_tl \<in> PrimRec1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_tl \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma maxR_commute:
  shows "{x,y} \<subseteq> Field r \<Longrightarrow> maxR x y = maxR y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} \<subseteq> Field r \<Longrightarrow> maxR x y = maxR y x
[PROOF STEP]
using r_Linear_order
[PROOF STATE]
proof (prove)
using this:
Linear_order r

goal (1 subgoal):
 1. {x, y} \<subseteq> Field r \<Longrightarrow> maxR x y = maxR y x
[PROOF STEP]
unfolding maxR_def
[PROOF STATE]
proof (prove)
using this:
Linear_order r

goal (1 subgoal):
 1. {x, y} \<subseteq> Field r \<Longrightarrow> (if (x, y) \<in> r then y else x) = (if (y, x) \<in> r then x else y)
[PROOF STEP]
by (fastforce simp: order_on_defs antisym_def total_on_def)


[STATEMENT]
lemma L2_set_right_distrib:
  "0 \<le> r \<Longrightarrow> r * L2_set f A = L2_set (\<lambda>x. r * f x) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> r * L2_set f A = L2_set (\<lambda>x. r * f x) A
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> r * sqrt (\<Sum>i\<in>A. (f i)\<^sup>2) = sqrt (\<Sum>i\<in>A. (r * f i)\<^sup>2)
[PROOF STEP]
apply (simp add: power_mult_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> r * sqrt (\<Sum>i\<in>A. (f i)\<^sup>2) = sqrt (\<Sum>i\<in>A. r\<^sup>2 * (f i)\<^sup>2)
[PROOF STEP]
apply (simp add: sum_distrib_left [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> r * sqrt (\<Sum>i\<in>A. (f i)\<^sup>2) = sqrt (r\<^sup>2 * (\<Sum>i\<in>A. (f i)\<^sup>2))
[PROOF STEP]
apply (simp add: real_sqrt_mult sum_nonneg)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma involution_sub_card :
  assumes "involution_on A \<phi>"
      and "finite A"
      and "S \<subseteq> A"
      and "\<forall>x\<in>A. (x \<in> S) = (\<phi> x \<notin> S)"
    shows "2 * card S = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
have "card S = card (A - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S = card (A - S)
[PROOF STEP]
using assms bij_betw_same_card involution_sub_bij
[PROOF STATE]
proof (prove)
using this:
involution_on A \<phi>
finite A
S \<subseteq> A
\<forall>x\<in>A. (x \<in> S) = (\<phi> x \<notin> S)
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B
\<lbrakk>involution_on ?A ?\<phi>; ?S \<subseteq> ?A; \<forall>x\<in>?A. (x \<in> ?S) = (?\<phi> x \<notin> ?S)\<rbrakk> \<Longrightarrow> bij_betw ?\<phi> ?S (?A - ?S)

goal (1 subgoal):
 1. card S = card (A - S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card S = card (A - S)

goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card S = card (A - S)

goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
have "... = card A - card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A - S) = card A - card S
[PROOF STEP]
by (meson assms card_Diff_subset rev_finite_subset)
[PROOF STATE]
proof (state)
this:
card (A - S) = card A - card S

goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card S = card A - card S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card S = card A - card S

goal (1 subgoal):
 1. 2 * card S = card A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * card S = card A

goal:
No subgoals!
[PROOF STEP]
qed