[STATEMENT]
lemma set_iterator_genord_product_correct :
  fixes it_a :: "('a,'\<sigma>) set_iterator"
  fixes it_b :: "'a \<Rightarrow> ('b,'\<sigma>) set_iterator"
  assumes it_a: "set_iterator_genord it_a S_a R_a"
  assumes it_b: "\<And>a. a \<in> S_a \<Longrightarrow> set_iterator_genord (it_b a) (S_b a) (R_b a)"
  shows "set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b)
             (set_iterator_product_order R_a R_b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
from it_a
[PROOF STATE]
proof (chain)
picking this:
set_iterator_genord it_a S_a R_a
[PROOF STEP]
obtain as where
    dist_as: "distinct as" and S_a_eq: "S_a = set as" and
    sorted_as: "sorted_wrt R_a as" and it_a_eq: "it_a = foldli as"
[PROOF STATE]
proof (prove)
using this:
set_iterator_genord it_a S_a R_a

goal (1 subgoal):
 1. (\<And>as. \<lbrakk>distinct as; S_a = set as; sorted_wrt R_a as; it_a = foldli as\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_iterator_genord_foldli_conv
[PROOF STATE]
proof (prove)
using this:
\<exists>l0. distinct l0 \<and> S_a = set l0 \<and> sorted_wrt R_a l0 \<and> it_a = foldli l0

goal (1 subgoal):
 1. (\<And>as. \<lbrakk>distinct as; S_a = set as; sorted_wrt R_a as; it_a = foldli as\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct as
S_a = set as
sorted_wrt R_a as
it_a = foldli as

goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
from it_b
[PROOF STATE]
proof (chain)
picking this:
?a \<in> S_a \<Longrightarrow> set_iterator_genord (it_b ?a) (S_b ?a) (R_b ?a)
[PROOF STEP]
obtain bs where
    dist_bs: "\<And>a. a \<in> set as \<Longrightarrow> distinct (bs a)" and S_b_eq: "\<And>a. a \<in> set as \<Longrightarrow>  S_b a = set (bs a)" and
    sorted_bs: "\<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a)" and
    it_b_eq: "\<And>a. a \<in> set as \<Longrightarrow> it_b a = foldli (bs a)"
[PROOF STATE]
proof (prove)
using this:
?a \<in> S_a \<Longrightarrow> set_iterator_genord (it_b ?a) (S_b ?a) (R_b ?a)

goal (1 subgoal):
 1. (\<And>bs. \<lbrakk>\<And>a. a \<in> set as \<Longrightarrow> distinct (bs a); \<And>a. a \<in> set as \<Longrightarrow> S_b a = set (bs a); \<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a); \<And>a. a \<in> set as \<Longrightarrow> it_b a = foldli (bs a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_iterator_genord_foldli_conv
[PROOF STATE]
proof (prove)
using this:
?a \<in> S_a \<Longrightarrow> \<exists>l0. distinct l0 \<and> S_b ?a = set l0 \<and> sorted_wrt (R_b ?a) l0 \<and> it_b ?a = foldli l0

goal (1 subgoal):
 1. (\<And>bs. \<lbrakk>\<And>a. a \<in> set as \<Longrightarrow> distinct (bs a); \<And>a. a \<in> set as \<Longrightarrow> S_b a = set (bs a); \<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a); \<And>a. a \<in> set as \<Longrightarrow> it_b a = foldli (bs a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis S_a_eq)
[PROOF STATE]
proof (state)
this:
?a \<in> set as \<Longrightarrow> distinct (bs ?a)
?a \<in> set as \<Longrightarrow> S_b ?a = set (bs ?a)
?a \<in> set as \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
?a \<in> set as \<Longrightarrow> it_b ?a = foldli (bs ?a)

goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
let ?abs = "concat (map (\<lambda>a. map (\<lambda>b. (a, b)) (bs a)) as)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)
[PROOF STEP]
proof (rule set_iterator_genord_I[of ?abs])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 3. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 4. set_iterator_product it_a it_b = foldli (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
from set_iterator_product_it_b_cong[of it_a S_a it_b,
       OF set_iterator_intro[OF it_a] it_b_eq] it_a_eq S_a_eq
[PROOF STATE]
proof (chain)
picking this:
(\<And>a. a \<in> S_a \<Longrightarrow> a \<in> set as) \<Longrightarrow> set_iterator_product it_a it_b = set_iterator_product it_a (\<lambda>a. foldli (bs a))
it_a = foldli as
S_a = set as
[PROOF STEP]
have "set_iterator_product it_a it_b =
          set_iterator_product (foldli as) (\<lambda>a. foldli (bs a))"
[PROOF STATE]
proof (prove)
using this:
(\<And>a. a \<in> S_a \<Longrightarrow> a \<in> set as) \<Longrightarrow> set_iterator_product it_a it_b = set_iterator_product it_a (\<lambda>a. foldli (bs a))
it_a = foldli as
S_a = set as

goal (1 subgoal):
 1. set_iterator_product it_a it_b = set_iterator_product (foldli as) (\<lambda>a. foldli (bs a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_iterator_product it_a it_b = set_iterator_product (foldli as) (\<lambda>a. foldli (bs a))

goal (4 subgoals):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 3. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 4. set_iterator_product it_a it_b = foldli (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
thus "set_iterator_product it_a it_b = foldli ?abs"
[PROOF STATE]
proof (prove)
using this:
set_iterator_product it_a it_b = set_iterator_product (foldli as) (\<lambda>a. foldli (bs a))

goal (1 subgoal):
 1. set_iterator_product it_a it_b = foldli (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
by (simp add: set_iterator_product_foldli_conv)
[PROOF STATE]
proof (state)
this:
set_iterator_product it_a it_b = foldli (concat (map (\<lambda>a. map (Pair a) (bs a)) as))

goal (3 subgoals):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 3. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 3. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
show "distinct ?abs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
using dist_as dist_bs[unfolded S_a_eq]
[PROOF STATE]
proof (prove)
using this:
distinct as
?a \<in> set as \<Longrightarrow> distinct (bs ?a)

goal (1 subgoal):
 1. distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
by (induct as)
       (simp_all add: distinct_map inj_on_def dist_bs set_eq_iff image_iff)
[PROOF STATE]
proof (state)
this:
distinct (concat (map (\<lambda>a. map (Pair a) (bs a)) as))

goal (2 subgoals):
 1. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
 2. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
show "Sigma S_a S_b = set ?abs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
unfolding S_a_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma (set as) S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
using S_b_eq
[PROOF STATE]
proof (prove)
using this:
?a \<in> set as \<Longrightarrow> S_b ?a = set (bs ?a)

goal (1 subgoal):
 1. Sigma (set as) S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
by (induct as) auto
[PROOF STATE]
proof (state)
this:
Sigma S_a S_b = set (concat (map (\<lambda>a. map (Pair a) (bs a)) as))

goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
from sorted_as sorted_bs dist_as
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt R_a as
?a \<in> set as \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
distinct as
[PROOF STEP]
show "sorted_wrt
           (set_iterator_product_order R_a R_b)
           (concat (map (\<lambda>a. map (Pair a) (bs a)) as))"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt R_a as
?a \<in> set as \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
distinct as

goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
[PROOF STEP]
proof (induct as rule: list.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>sorted_wrt R_a []; \<And>a. a \<in> set [] \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct []\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) []))
 2. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
sorted_wrt R_a []
?a \<in> set [] \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
distinct []

goal (2 subgoals):
 1. \<lbrakk>sorted_wrt R_a []; \<And>a. a \<in> set [] \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct []\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) []))
 2. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt R_a []
?a \<in> set [] \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
distinct []

goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) []))

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
case (Cons a as)
[PROOF STATE]
proof (state)
this:
\<lbrakk>sorted_wrt R_a as; \<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct as\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))
sorted_wrt R_a (a # as)
?a \<in> set (a # as) \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
distinct (a # as)

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt R_a (a # as)
[PROOF STEP]
have R_a_as: "\<And>a'. a' \<in> set as \<Longrightarrow> R_a a a'" and
                        sorted_as: "sorted_wrt R_a as"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt R_a (a # as)

goal (1 subgoal):
 1. (\<And>a'. a' \<in> set as \<Longrightarrow> R_a a a') &&& sorted_wrt R_a as
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
?a' \<in> set as \<Longrightarrow> R_a a ?a'
sorted_wrt R_a as

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
?a \<in> set (a # as) \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)
[PROOF STEP]
have sorted_bs_a: "sorted_wrt (R_b a) (bs a)"
                    and sorted_bs_as: "\<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a)"
[PROOF STATE]
proof (prove)
using this:
?a \<in> set (a # as) \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)

goal (1 subgoal):
 1. sorted_wrt (R_b a) (bs a) &&& (\<And>a. a \<in> set as \<Longrightarrow> sorted_wrt (R_b a) (bs a))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
sorted_wrt (R_b a) (bs a)
?a \<in> set as \<Longrightarrow> sorted_wrt (R_b ?a) (bs ?a)

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
from Cons(4)
[PROOF STATE]
proof (chain)
picking this:
distinct (a # as)
[PROOF STEP]
have dist_as: "distinct as" and a_nin_as: "a \<notin> set as"
[PROOF STATE]
proof (prove)
using this:
distinct (a # as)

goal (1 subgoal):
 1. distinct as &&& a \<notin> set as
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
distinct as
a \<notin> set as

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
note ind_hyp = Cons(1)[OF sorted_as sorted_bs_as dist_as]
[PROOF STATE]
proof (state)
this:
(\<And>a. a \<in> set as \<Longrightarrow> a \<in> set as) \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
define bs_a where "bs_a = bs a"
[PROOF STATE]
proof (state)
this:
bs_a = bs a

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
from sorted_bs_a
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt (R_b a) (bs a)
[PROOF STEP]
have sorted_prod_a : "sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) (bs a))"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (R_b a) (bs a)

goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) (bs a))
[PROOF STEP]
unfolding bs_a_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (R_b a) bs_a

goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) bs_a)
[PROOF STEP]
apply (induct bs_a rule: list.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sorted_wrt (R_b a) [] \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) [])
 2. \<And>x1 x2. \<lbrakk>sorted_wrt (R_b a) x2 \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) x2); sorted_wrt (R_b a) (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) (x1 # x2))
[PROOF STEP]
apply (simp_all add: set_iterator_product_order_def Ball_def image_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sorted_wrt (set_iterator_product_order R_a R_b) (map (Pair a) (bs a))

goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>\<lbrakk>sorted_wrt R_a x2; \<And>a. a \<in> set x2 \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct x2\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) x2)); sorted_wrt R_a (x1 # x2); \<And>a. a \<in> set (x1 # x2) \<Longrightarrow> sorted_wrt (R_b a) (bs a); distinct (x1 # x2)\<rbrakk> \<Longrightarrow> sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (x1 # x2)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (a # as)))
[PROOF STEP]
apply (simp add: sorted_wrt_append ind_hyp sorted_prod_a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (bs a). \<forall>y\<in>set as. \<forall>xa\<in>set (bs y). set_iterator_product_order R_a R_b (a, x) (y, xa)
[PROOF STEP]
apply (simp add: set_iterator_product_order_def R_a_as a_nin_as)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) (a # as)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt (set_iterator_product_order R_a R_b) (concat (map (\<lambda>a. map (Pair a) (bs a)) as))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_iterator_genord (set_iterator_product it_a it_b) (Sigma S_a S_b) (set_iterator_product_order R_a R_b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Module.module) nested_submodules:
assumes "submodule R W M"
assumes "submodule R X M"
assumes "X \<subseteq> W"
shows "submodule R X (md W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.submodule R X (md W)
[PROOF STEP]
unfolding submodule_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (module R (md W) \<and> X \<subseteq> carrier (md W)) \<and> (\<forall>v w. v \<in> X \<longrightarrow> w \<in> X \<longrightarrow> v \<oplus>\<^bsub>md W\<^esub> w \<in> X) \<and> \<zero>\<^bsub>md W\<^esub> \<in> X \<and> (\<forall>c v. c \<in> carrier R \<longrightarrow> v \<in> X \<longrightarrow> c \<odot>\<^bsub>md W\<^esub> v \<in> X)
[PROOF STEP]
using \<open>X \<subseteq> W\<close> submodule_is_module[OF \<open>submodule R W M\<close>]
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> W
module R (md W)

goal (1 subgoal):
 1. (module R (md W) \<and> X \<subseteq> carrier (md W)) \<and> (\<forall>v w. v \<in> X \<longrightarrow> w \<in> X \<longrightarrow> v \<oplus>\<^bsub>md W\<^esub> w \<in> X) \<and> \<zero>\<^bsub>md W\<^esub> \<in> X \<and> (\<forall>c v. c \<in> carrier R \<longrightarrow> v \<in> X \<longrightarrow> c \<odot>\<^bsub>md W\<^esub> v \<in> X)
[PROOF STEP]
using \<open>submodule R X M\<close>[unfolded submodule_def]
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> W
module R (md W)
(module R M \<and> X \<subseteq> carrier M) \<and> (\<forall>v w. v \<in> X \<longrightarrow> w \<in> X \<longrightarrow> v \<oplus>\<^bsub>M\<^esub> w \<in> X) \<and> \<zero>\<^bsub>M\<^esub> \<in> X \<and> (\<forall>c v. c \<in> carrier R \<longrightarrow> v \<in> X \<longrightarrow> c \<odot>\<^bsub>M\<^esub> v \<in> X)

goal (1 subgoal):
 1. (module R (md W) \<and> X \<subseteq> carrier (md W)) \<and> (\<forall>v w. v \<in> X \<longrightarrow> w \<in> X \<longrightarrow> v \<oplus>\<^bsub>md W\<^esub> w \<in> X) \<and> \<zero>\<^bsub>md W\<^esub> \<in> X \<and> (\<forall>c v. c \<in> carrier R \<longrightarrow> v \<in> X \<longrightarrow> c \<odot>\<^bsub>md W\<^esub> v \<in> X)
[PROOF STEP]
by auto


[STATEMENT]
lemma fiter_fusion:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  assumes "mono f"
  and "mono g"
shows "fiter f g = fiter_id g \<circ> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
have h1: "mono (fiter_fun id g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (fiter_fun id g)
[PROOF STEP]
by (simp add: assms(2) iso_fiter_fun2 iso_id)
[PROOF STATE]
proof (state)
this:
mono (fiter_fun id g)

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
have h2: "mono (fiter_fun f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (fiter_fun f g)
[PROOF STEP]
by (simp add: assms(1) assms(2) iso_fiter_fun2)
[PROOF STATE]
proof (state)
this:
mono (fiter_fun f g)

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
have h3: "Inf \<circ> image (\<lambda>x. x \<circ> f) = (\<lambda>x. x \<circ> f) \<circ> Inf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf \<circ> (`) (\<lambda>x. x \<circ> f) = (\<lambda>x. x \<circ> f) \<circ> Inf
[PROOF STEP]
by (simp add: fun_eq_iff image_comp)
[PROOF STATE]
proof (state)
this:
Inf \<circ> (`) (\<lambda>x. x \<circ> f) = (\<lambda>x. x \<circ> f) \<circ> Inf

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
have "(\<lambda>x. x \<circ> f) \<circ> (fiter_fun id g) = (fiter_fun f g) \<circ> (\<lambda>x. x \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<circ> f) \<circ> fiter_fun id g = fiter_fun f g \<circ> (\<lambda>x. x \<circ> f)
[PROOF STEP]
by (simp add: fun_eq_iff fiter_fun_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x \<circ> f) \<circ> fiter_fun id g = fiter_fun f g \<circ> (\<lambda>x. x \<circ> f)

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x \<circ> f) \<circ> fiter_fun id g = fiter_fun f g \<circ> (\<lambda>x. x \<circ> f)

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
using gfp_fusion_inf_pres
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x \<circ> f) \<circ> fiter_fun id g = fiter_fun f g \<circ> (\<lambda>x. x \<circ> f)
\<lbrakk>Inf_pres ?h; mono ?f; mono ?g; ?h \<circ> ?f = ?g \<circ> ?h\<rbrakk> \<Longrightarrow> ?h (gfp ?f) = gfp ?g

goal (1 subgoal):
 1. fiter f g = fiter_id g \<circ> f
[PROOF STEP]
by (metis fiter_def fiter_id_def h1 h2 h3)
[PROOF STATE]
proof (state)
this:
fiter f g = fiter_id g \<circ> f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_mod_add_eq_imp_add_mod_le: "
  \<lbrakk> a \<le> b; (a + k) mod m = (b::nat) mod m \<rbrakk> \<Longrightarrow> a + k mod m \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; (a + k) mod m = b mod m\<rbrakk> \<Longrightarrow> a + k mod m \<le> b
[PROOF STEP]
by (metis add_le_mono2 diff_add_inverse le_add1 le_add_diff_inverse mod_diff1_eq mod_less_eq_dividend)


[STATEMENT]
lemma iprev_less_mono_rev: "
  \<lbrakk> iprev a I < iprev b I; a \<in> I; b \<in> I \<rbrakk> \<Longrightarrow> a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>iprev a I < iprev b I; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> a < b
[PROOF STEP]
apply (rule ccontr, simp add: linorder_not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>iprev a I < iprev b I; a \<in> I; b \<in> I; b \<le> a\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis iprev_le_mono less_le_not_le)


[STATEMENT]
lemma negligible_cmult: "negligible (\<lambda>\<eta>. c * f \<eta>) \<longleftrightarrow> negligible f \<or> c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<lambda>\<eta>. c * f \<eta>) = (negligible f \<or> c = 0)
[PROOF STEP]
by(auto intro!: negligibleI dest!: negligibleD)


[STATEMENT]
lemma poly_add_rat_code[code]: "poly_add_rat r p \<equiv> case quotient_of r of (n,d) \<Rightarrow>
     let p' = (let fs = coeffs p; k = length fs in poly_of_list (map (\<lambda>(fi, i). fi * d ^ (k - Suc i)) (zip fs [0..<k])));
         p'' = p' \<circ>\<^sub>p [:-n,d:]
      in p''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add_rat r p \<equiv> case quotient_of r of (n, d) \<Rightarrow> let p' = let fs = coeffs p; k = length fs in poly_of_list (map2 (\<lambda>fi i. fi * d ^ (k - Suc i)) fs [0..<k]); p'' = p' \<circ>\<^sub>p [:- n, d:] in p''
[PROOF STEP]
unfolding poly_add_rat_def poly_mult_rat_main_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. case quotient_of r of (n, d) \<Rightarrow> poly_of_list (map2 (\<lambda>fi i. fi * 1 ^ i * d ^ (length (coeffs p) - Suc i)) (coeffs p) [0..<length (coeffs p)]) \<circ>\<^sub>p [:- n, d:] \<equiv> case quotient_of r of (n, d) \<Rightarrow> poly_of_list (map2 (\<lambda>fi i. fi * d ^ (length (coeffs p) - Suc i)) (coeffs p) [0..<length (coeffs p)]) \<circ>\<^sub>p [:- n, d:]
[PROOF STEP]
by simp


[STATEMENT]
lemma m_zmax_gt_eachTr:
      "(\<forall>j \<le> n. f j \<in> Zset) \<longrightarrow> (\<forall>j \<le> n. (f j) \<le> m_zmax n f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>n. f j \<le> m_zmax n f)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>0. f j \<le> m_zmax 0 f)
 2. \<And>n. (\<forall>j\<le>n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>n. f j \<le> m_zmax n f) \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>Suc n. f j \<le> m_zmax (Suc n) f)
[PROOF STEP]
apply (rule impI, rule allI, rule impI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>n. f j \<le> m_zmax n f) \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>Suc n. f j \<le> m_zmax (Suc n) f)
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j \<in> Zset) \<longrightarrow> (\<forall>j\<le>n. f j \<le> m_zmax n f); \<forall>j\<le>Suc n. f j \<in> Zset\<rbrakk> \<Longrightarrow> \<forall>j\<le>Suc n. f j \<le> m_zmax (Suc n) f
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset\<rbrakk> \<Longrightarrow> \<forall>j\<le>Suc n. f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (rule allI, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n j. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset; j \<le> Suc n\<rbrakk> \<Longrightarrow> f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (case_tac "j = Suc n", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n j. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset; j = Suc n\<rbrakk> \<Longrightarrow> f (Suc n) \<le> zmax (m_zmax n f) (f (Suc n))
 2. \<And>n j. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset; j \<le> Suc n; j \<noteq> Suc n\<rbrakk> \<Longrightarrow> f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (simp add:zmax_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n j. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset; j \<le> Suc n; j \<noteq> Suc n\<rbrakk> \<Longrightarrow> f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (drule_tac m = j and n = "Suc n" in noteq_le_less, assumption,
        drule_tac x = j and n = "Suc n" in less_le_diff, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n j. \<lbrakk>\<forall>j\<le>n. f j \<le> m_zmax n f; \<forall>j\<le>Suc n. f j \<in> Zset; j \<le> n\<rbrakk> \<Longrightarrow> f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (drule_tac a = j in forall_spec, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n j. \<lbrakk>\<forall>j\<le>Suc n. f j \<in> Zset; j \<le> n; f j \<le> m_zmax n f\<rbrakk> \<Longrightarrow> f j \<le> zmax (m_zmax n f) (f (Suc n))
[PROOF STEP]
apply (simp add:zmax_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arccos_1 [simp]: "arccos 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos 1 = 0
[PROOF STEP]
using arccos_cos
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?x; ?x \<le> pi\<rbrakk> \<Longrightarrow> arccos (cos ?x) = ?x

goal (1 subgoal):
 1. arccos 1 = 0
[PROOF STEP]
by force


[STATEMENT]
lemma finiteIncLevel: "finite (incLevel ` A) = finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (incLevel ` A) = finite A
[PROOF STEP]
apply (insert injIncLevel, rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>inj incLevel; finite (incLevel ` A)\<rbrakk> \<Longrightarrow> finite A
 2. \<lbrakk>inj incLevel; finite A\<rbrakk> \<Longrightarrow> finite (incLevel ` A)
[PROOF STEP]
apply(frule finite_imageD)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>inj incLevel; finite (incLevel ` A)\<rbrakk> \<Longrightarrow> inj_on incLevel A
 2. \<lbrakk>inj incLevel; finite (incLevel ` A); finite A\<rbrakk> \<Longrightarrow> finite A
 3. \<lbrakk>inj incLevel; finite A\<rbrakk> \<Longrightarrow> finite (incLevel ` A)
[PROOF STEP]
apply (blast intro: subset_inj_on, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj incLevel; finite A\<rbrakk> \<Longrightarrow> finite (incLevel ` A)
[PROOF STEP]
apply(rule finite_imageI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj incLevel; finite A\<rbrakk> \<Longrightarrow> finite A
[PROOF STEP]
by assumption
  \<comment> \<open>FIXME often have injOn f A, finite f ` A, to show A finite\<close>


[STATEMENT]
lemma nth_prime_at_top: "filterlim nth_prime at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim nth_prime sequentially sequentially
[PROOF STEP]
proof (rule filterlim_at_top_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filterlim ?f sequentially sequentially
 2. \<forall>\<^sub>F x in sequentially. ?f x \<le> nth_prime x
[PROOF STEP]
show "filterlim (\<lambda>n::nat. n + 2) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM n sequentially. n + 2 :> sequentially
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
LIM n sequentially. n + 2 :> sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. x + 2 \<le> nth_prime x
[PROOF STEP]
qed (auto simp: nth_prime_lower_bound)


[STATEMENT]
lemma wnf_lemma_3:
  "(n(p * L) * n(r * L) \<squnion> an(p * L) * an(q * L)) * an(p * L) = an(p * L) * an(q * L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n (p * L) * n (r * L) \<squnion> an (p * L) * an (q * L)) * an (p * L) = an (p * L) * an (q * L)
[PROOF STEP]
by (metis an_n_def sup_commute wnf_lemma_1 n_an_def)


[STATEMENT]
lemma i_Exec_Comp_Stream_Acc_Output__eq_NoMsg_iAll_start_event_conv: "
  \<lbrakk> 0 < k; \<And> t. event t = (t mod k = 0); t0 = t * k;
    s = (output_fun \<circ> i_Exec_Comp_Stream trans_fun (input \<odot>\<^sub>i k) c) \<rbrakk>\<Longrightarrow>
  ((i_Exec_Comp_Stream_Acc_Output k output_fun trans_fun input c) t = \<NoMsg>) =
  (s t0 = \<NoMsg> \<and> (\<circle> t' t0 [0\<dots>]. (s t1 = \<NoMsg>. t1 \<U> t2 [0\<dots>] \<oplus> t'. event t2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; \<And>t. event t = (t mod k = 0); t0 = t * k; s = output_fun \<circ> i_Exec_Comp_Stream trans_fun (input \<odot> k) c\<rbrakk> \<Longrightarrow> (i_Exec_Comp_Stream_Acc_Output k output_fun trans_fun input c t = NoMsg) = (s t0 = NoMsg \<and> (\<circle> t' t0 [0\<dots>]. s t1 = NoMsg. t1 \<U> t2 [0\<dots>] \<oplus> t'. event t2))
[PROOF STEP]
by (simp add: i_Exec_Comp_Stream_Acc_Output_def i_shrink_eq_NoMsg_iAll_start_event_conv)


[STATEMENT]
lemma set_times_rearrange: "(a *o C) * (b *o D) = (a * b) *o (C * D)"
  for a b :: "'a::comm_monoid_mult"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *o C * b *o D = (a * b) *o (C * D)
[PROOF STEP]
by (auto simp add: elt_set_times_def set_times_def; metis mult.assoc mult.left_commute)


[STATEMENT]
lemma valofd_less_2p: "valofd (x :: ('e, 'f) float) < 2 / 2^bias TYPE(('e, 'f) float)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valofd x < 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float)
[PROOF STEP]
unfolding valofd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float) * (real (fraction x) / 2 ^ LENGTH('f)) < 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float)
[PROOF STEP]
by (simp add: fraction_less_2p field_simps)


[STATEMENT]
lemma Eps_Opt_eq_Some :
assumes P_prop: "\<And>x'. P x \<Longrightarrow> P x' \<Longrightarrow> x' = x"
shows "Eps_Opt P = Some x \<longleftrightarrow> P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Eps_Opt P = Some x) = P x
[PROOF STEP]
using P_prop
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>P x; P ?x'\<rbrakk> \<Longrightarrow> ?x' = x

goal (1 subgoal):
 1. (Eps_Opt P = Some x) = P x
[PROOF STEP]
unfolding Eps_Opt_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>P x; P ?x'\<rbrakk> \<Longrightarrow> ?x' = x

goal (1 subgoal):
 1. ((if Ex P then Some (Eps P) else None) = Some x) = P x
[PROOF STEP]
by (metis option.inject option.simps(2) someI_ex)


[STATEMENT]
lemma line_integral_on_pair_path_strong:
  fixes F::"('a::euclidean_space) \<Rightarrow> ('a)" and
    g::"real \<Rightarrow> 'a" and
    \<gamma>::"(real \<Rightarrow> 'a)" and
    i::'a
  assumes i_norm_1: "norm i = 1" and
    g_orthogonal_to_i: "\<forall>x. g(x) \<bullet> i = 0" and
    gamma_is_in_terms_of_i: "\<gamma> = (\<lambda>x. f(x) *\<^sub>R i + g(f(x)))" and
    gamma_smooth: "\<gamma> piecewise_C1_differentiable_on {0 .. 1}" and
    g_continuous_on_f: "continuous_on (f ` {0..1}) g" and
    path_start_le_path_end: "(pathstart \<gamma>) \<bullet> i \<le> (pathfinish \<gamma>) \<bullet> i" and
    field_i_comp_cont: "continuous_on (path_image \<gamma>) (\<lambda>x. F x \<bullet> i)"
  shows "line_integral F {i} \<gamma>
         = integral (cbox ((pathstart \<gamma>) \<bullet> i) ((pathfinish \<gamma>) \<bullet> i)) (\<lambda>f_var. (F (f_var *\<^sub>R i + g(f_var)) \<bullet> i))"
    "line_integral_exists F {i} \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral F {i} \<gamma> = integral (cbox (pathstart \<gamma> \<bullet> i) (pathfinish \<gamma> \<bullet> i)) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) &&& line_integral_exists F {i} \<gamma>
[PROOF STEP]
proof (simp add: line_integral_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
obtain s where gamma_differentiable: "finite s" "(\<forall>x \<in> {0 .. 1} - s. \<gamma> differentiable at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. \<lbrakk>finite s; \<forall>x\<in>{0..1} - s. \<gamma> differentiable at x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using gamma_smooth
[PROOF STATE]
proof (prove)
using this:
\<gamma> piecewise_C1_differentiable_on {0..1}

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>finite s; \<forall>x\<in>{0..1} - s. \<gamma> differentiable at x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: C1_differentiable_on_eq piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
finite s
\<forall>x\<in>{0..1} - s. \<gamma> differentiable at x

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite s
\<forall>x\<in>{0..1} - s. \<gamma> differentiable at x
[PROOF STEP]
have gamma_i_component_smooth: "\<forall>x \<in> {0 .. 1} - s. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x"
[PROOF STATE]
proof (prove)
using this:
finite s
\<forall>x\<in>{0..1} - s. \<gamma> differentiable at x

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

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have field_cont_on_path: "continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
have 0: "(\<lambda>x. \<gamma> x \<bullet> i) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<gamma> x \<bullet> i) = f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<gamma> x \<bullet> i = f x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<gamma> x \<bullet> i = f x
[PROOF STEP]
show "\<gamma> x \<bullet> i = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> x \<bullet> i = f x
[PROOF STEP]
using g_orthogonal_to_i i_norm_1
[PROOF STATE]
proof (prove)
using this:
\<forall>x. g x \<bullet> i = 0
norm i = 1

goal (1 subgoal):
 1. \<gamma> x \<bullet> i = f x
[PROOF STEP]
by (simp only: gamma_is_in_terms_of_i  real_inner_class.inner_add_left g_orthogonal_to_i inner_scaleR_left inner_same_Basis norm_eq_1)
[PROOF STATE]
proof (state)
this:
\<gamma> x \<bullet> i = f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<gamma> x \<bullet> i) = f

goal (1 subgoal):
 1. continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (f ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
apply (rule continuous_on_compose2 [of _ "(\<lambda>x. F(x)  \<bullet> i)" "f ` { 0..1}" "(\<lambda>x. x *\<^sub>R i + g x)"]
          field_i_comp_cont g_continuous_on_f field_i_comp_cont continuous_intros)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f_var. f_var *\<^sub>R i + g f_var) ` f ` {0..1} \<subseteq> path_image \<gamma>
[PROOF STEP]
by (auto simp add: gamma_is_in_terms_of_i path_image_def)
[PROOF STATE]
proof (state)
this:
continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have path_start_le_path_end': "\<gamma> 0 \<bullet> i \<le> \<gamma> 1 \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> 0 \<bullet> i \<le> \<gamma> 1 \<bullet> i
[PROOF STEP]
using path_start_le_path_end
[PROOF STATE]
proof (prove)
using this:
pathstart \<gamma> \<bullet> i \<le> pathfinish \<gamma> \<bullet> i

goal (1 subgoal):
 1. \<gamma> 0 \<bullet> i \<le> \<gamma> 1 \<bullet> i
[PROOF STEP]
by (auto simp add: pathstart_def pathfinish_def)
[PROOF STATE]
proof (state)
this:
\<gamma> 0 \<bullet> i \<le> \<gamma> 1 \<bullet> i

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have gamm_cont: "continuous_on {0..1} (\<lambda>a. \<gamma> a \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>a. \<gamma> a \<bullet> i)
[PROOF STEP]
apply(rule continuous_on_inner)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. continuous_on {0..1} \<gamma>
 2. continuous_on {0..1} (\<lambda>x. i)
[PROOF STEP]
using gamma_smooth
[PROOF STATE]
proof (prove)
using this:
\<gamma> piecewise_C1_differentiable_on {0..1}

goal (2 subgoals):
 1. continuous_on {0..1} \<gamma>
 2. continuous_on {0..1} (\<lambda>x. i)
[PROOF STEP]
apply (simp add: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. i)
[PROOF STEP]
using continuous_on_const
[PROOF STATE]
proof (prove)
using this:
continuous_on ?s (\<lambda>x. ?c)

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

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (\<lambda>a. \<gamma> a \<bullet> i)
[PROOF STEP]
obtain c d where cd: "c \<le> d" "(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>a. \<gamma> a \<bullet> i)

goal (1 subgoal):
 1. (\<And>c d. \<lbrakk>c \<le> d; (\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson continuous_image_closed_interval zero_le_one)
[PROOF STATE]
proof (state)
this:
c \<le> d
(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<le> d
(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}
[PROOF STEP]
have subset_cd: "(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} \<subseteq> {c..d}"
[PROOF STATE]
proof (prove)
using this:
c \<le> d
(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}

goal (1 subgoal):
 1. (\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} \<subseteq> {c..d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} \<subseteq> {c..d}

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have field_cont_on_path_cd:
    "continuous_on {c..d} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {c..d} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
using field_cont_on_path cd
[PROOF STATE]
proof (prove)
using this:
continuous_on ((\<lambda>x. \<gamma> x \<bullet> i) ` {0..1}) (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
c \<le> d
(\<lambda>a. \<gamma> a \<bullet> i) ` {0..1} = {c..d}

goal (1 subgoal):
 1. continuous_on {c..d} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_on {c..d} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have path_vector_deriv_line_integrals:
    "\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative
                                          vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x))
                                                  (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x)
[PROOF STEP]
using gamma_i_component_smooth and derivative_component_fun_component and
      vector_derivative_works
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x
?f differentiable at ?x \<Longrightarrow> vector_derivative ?f (at ?x) \<bullet> ?i = vector_derivative (\<lambda>x. ?f x \<bullet> ?i) (at ?x)
(?f differentiable ?net) = (?f has_vector_derivative vector_derivative ?f ?net) ?net

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

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x)
[PROOF STEP]
have "\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative
                                          vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within ({0..1})))
                                                  (at x within ({0..1}))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x)

goal (1 subgoal):
 1. \<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
using has_vector_derivative_at_within vector_derivative_at_within_ivl
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x)
(?f has_vector_derivative ?f') (at ?x) \<Longrightarrow> (?f has_vector_derivative ?f') (at ?x within ?S)
\<lbrakk>(?f has_vector_derivative ?f') (at ?x); ?a \<le> ?x; ?x \<le> ?b; ?a < ?b\<rbrakk> \<Longrightarrow> vector_derivative ?f (at ?x within {?a..?b}) = ?f'

goal (1 subgoal):
 1. \<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
have has_int:"((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral
           integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
using has_integral_substitution_strong[OF gamma_differentiable(1) rel_simps(44)
        path_start_le_path_end' subset_cd field_cont_on_path_cd gamm_cont,
        of "(\<lambda>x. vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x within ({0..1})))"]
      gamma_is_in_terms_of_i
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})
(\<And>x. x \<in> {0..1} - s \<Longrightarrow> ((\<lambda>a. \<gamma> a \<bullet> i) has_real_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) (at x within {0..1})) \<Longrightarrow> ((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
\<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x))

goal (1 subgoal):
 1. ((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
by (auto simp only: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
have has_int':"((\<lambda>x. (F(\<gamma>(x)) \<bullet> i)*(vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x within ({0..1})))) has_integral
           integral {((pathstart \<gamma>) \<bullet> i)..((pathfinish \<gamma>) \<bullet> i)} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
using  gamma_is_in_terms_of_i i_norm_1
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) has_integral integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
\<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x))
norm i = 1

goal (1 subgoal):
 1. ((\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
apply (auto simp add: pathstart_def pathfinish_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. vector_derivative (\<lambda>x. (f x *\<^sub>R i + g (f x)) \<bullet> i) (at x within {0..1}) * (F (((f x *\<^sub>R i + g (f x)) \<bullet> i) *\<^sub>R i + g ((f x *\<^sub>R i + g (f x)) \<bullet> i)) \<bullet> i)) has_integral integral {(f 0 *\<^sub>R i + g (f 0)) \<bullet> i..(f 1 *\<^sub>R i + g (f 1)) \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}; \<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x)); norm i = 1\<rbrakk> \<Longrightarrow> ((\<lambda>x. F (f x *\<^sub>R i + g (f x)) \<bullet> i * vector_derivative (\<lambda>x. (f x *\<^sub>R i + g (f x)) \<bullet> i) (at x within {0..1})) has_integral integral {(f 0 *\<^sub>R i + g (f 0)) \<bullet> i..(f 1 *\<^sub>R i + g (f 1)) \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
apply (simp only:  real_inner_class.inner_add_left inner_not_same_Basis g_orthogonal_to_i inner_scaleR_left norm_eq_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. vector_derivative (\<lambda>x. f x * 1 + 0) (at x within {0..1}) * (F ((f x * 1 + 0) *\<^sub>R i + g (f x * 1 + 0)) \<bullet> i)) has_integral integral {f 0 * 1 + 0..f 1 * 1 + 0} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}; \<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x)); i \<bullet> i = 1\<rbrakk> \<Longrightarrow> ((\<lambda>x. F (f x *\<^sub>R i + g (f x)) \<bullet> i * vector_derivative (\<lambda>x. f x * 1 + 0) (at x within {0..1})) has_integral integral {f 0 * 1 + 0..f 1 * 1 + 0} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have substitute:
    "integral ({((pathstart \<gamma>) \<bullet> i)..((pathfinish \<gamma>) \<bullet> i)}) (\<lambda>f_var. (F (f_var *\<^sub>R i + g(f_var)) \<bullet> i))
                 = integral ({0..1}) (\<lambda>x. (F(\<gamma>(x)) \<bullet> i)*(vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x within ({0..1}))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))
[PROOF STEP]
using gamma_is_in_terms_of_i integral_unique[OF has_int] i_norm_1
[PROOF STATE]
proof (prove)
using this:
\<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x))
integral {0..1} (\<lambda>x. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) *\<^sub>R (F ((\<gamma> x \<bullet> i) *\<^sub>R i + g (\<gamma> x \<bullet> i)) \<bullet> i)) = integral {\<gamma> 0 \<bullet> i..\<gamma> 1 \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
norm i = 1

goal (1 subgoal):
 1. integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))
[PROOF STEP]
apply (auto simp add: pathstart_def pathfinish_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x)); integral {0..1} (\<lambda>x. vector_derivative (\<lambda>x. (f x *\<^sub>R i + g (f x)) \<bullet> i) (at x within {0..1}) * (F (((f x *\<^sub>R i + g (f x)) \<bullet> i) *\<^sub>R i + g ((f x *\<^sub>R i + g (f x)) \<bullet> i)) \<bullet> i)) = integral {(f 0 *\<^sub>R i + g (f 0)) \<bullet> i..(f 1 *\<^sub>R i + g (f 1)) \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i); norm i = 1\<rbrakk> \<Longrightarrow> integral {(f 0 *\<^sub>R i + g (f 0)) \<bullet> i..(f 1 *\<^sub>R i + g (f 1)) \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (f x *\<^sub>R i + g (f x)) \<bullet> i * vector_derivative (\<lambda>x. (f x *\<^sub>R i + g (f x)) \<bullet> i) (at x within {0..1}))
[PROOF STEP]
apply (simp only:  real_inner_class.inner_add_left inner_not_same_Basis g_orthogonal_to_i inner_scaleR_left norm_eq_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<gamma> = (\<lambda>x. f x *\<^sub>R i + g (f x)); integral {0..1} (\<lambda>x. vector_derivative (\<lambda>x. f x * 1 + 0) (at x within {0..1}) * (F ((f x * 1 + 0) *\<^sub>R i + g (f x * 1 + 0)) \<bullet> i)) = integral {f 0 * 1 + 0..f 1 * 1 + 0} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i); i \<bullet> i = 1\<rbrakk> \<Longrightarrow> integral {f 0 * 1 + 0..f 1 * 1 + 0} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (f x *\<^sub>R i + g (f x)) \<bullet> i * vector_derivative (\<lambda>x. f x * 1 + 0) (at x within {0..1}))
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have comp_in_eq_comp_out: "\<forall>x \<in> {0..1} - s.
            (vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x within {0..1}))
                = (vector_derivative \<gamma> (at x within {0..1})) \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1} - s. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
fix x:: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
assume ass:"x \<in> {0..1} -s"
[PROOF STATE]
proof (state)
this:
x \<in> {0..1} - s

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..1} - s
[PROOF STEP]
have x_bounds:"x \<in> {0..1}"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..1} - s

goal (1 subgoal):
 1. x \<in> {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {0..1}

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

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

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<gamma> differentiable at x
[PROOF STEP]
have dotprod_in_is_out:
      "vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x)
                         = (vector_derivative \<gamma> (at x)) \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
\<gamma> differentiable at x

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i
[PROOF STEP]
using derivative_component_fun_component
[PROOF STATE]
proof (prove)
using this:
\<gamma> differentiable at x
?f differentiable at ?x \<Longrightarrow> vector_derivative ?f (at ?x) \<bullet> ?i = vector_derivative (\<lambda>x. ?f x \<bullet> ?i) (at ?x)

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

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i
[PROOF STEP]
have 0: "(vector_derivative \<gamma> (at x)) \<bullet> i = (vector_derivative \<gamma> (at x within {0..1})) \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i

goal (1 subgoal):
 1. vector_derivative \<gamma> (at x) \<bullet> i = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i \<Longrightarrow> vector_derivative \<gamma> (at x) \<bullet> i = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
have "(\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)
[PROOF STEP]
using \<open>\<gamma> differentiable at x\<close> vector_derivative_works
[PROOF STATE]
proof (prove)
using this:
\<gamma> differentiable at x
(?f differentiable ?net) = (?f has_vector_derivative vector_derivative ?f ?net) ?net

goal (1 subgoal):
 1. (\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)

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

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i \<Longrightarrow> vector_derivative \<gamma> (at x) \<bullet> i = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
have "0 \<le> x \<and> x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<and> x \<le> 1
[PROOF STEP]
using x_bounds
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..1}

goal (1 subgoal):
 1. 0 \<le> x \<and> x \<le> 1
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
0 \<le> x \<and> x \<le> 1

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i \<Longrightarrow> vector_derivative \<gamma> (at x) \<bullet> i = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)
0 \<le> x \<and> x \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<gamma> has_vector_derivative vector_derivative \<gamma> (at x)) (at x)
0 \<le> x \<and> x \<le> 1

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

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

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - s \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
[PROOF STEP]
have 1: "vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma>(x) \<bullet> i) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
using path_vector_deriv_line_integrals and vector_derivative_at_within_ivl and
        x_bounds
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1} - s. ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x)
\<lbrakk>(?f has_vector_derivative ?f') (at ?x); ?a \<le> ?x; ?x \<le> ?b; ?a < ?b\<rbrakk> \<Longrightarrow> vector_derivative ?f (at ?x within {?a..?b}) = ?f'
x \<in> {0..1}

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

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

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

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

goal (2 subgoals):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
 2. line_integral_exists F {i} \<gamma>
[PROOF STEP]
show "integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) =
                   integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
using substitute and comp_in_eq_comp_out and negligible_finite
      Henstock_Kurzweil_Integration.integral_spike
      [of "s" "{0..1}" "(\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i))"
        "(\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))"]
[PROOF STATE]
proof (prove)
using this:
integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i) = integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))
\<forall>x\<in>{0..1} - s. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
finite ?s \<Longrightarrow> negligible ?s
\<lbrakk>negligible s; \<And>x. x \<in> {0..1} - s \<Longrightarrow> F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i) = F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})\<rbrakk> \<Longrightarrow> integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) = integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)
[PROOF STEP]
by (metis (no_types, lifting) gamma_differentiable(1))
[PROOF STATE]
proof (state)
this:
integral {0..1} (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) = integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have "((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral
                   integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
using has_int' and comp_in_eq_comp_out and negligible_finite
      Henstock_Kurzweil_Integration.has_integral_spike
      [of "s" "{0..1}" "(\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i))"
        "(\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}))"
        "integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
\<forall>x\<in>{0..1} - s. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative \<gamma> (at x within {0..1}) \<bullet> i
finite ?s \<Longrightarrow> negligible ?s
\<lbrakk>negligible s; \<And>x. x \<in> {0..1} - s \<Longrightarrow> F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i) = F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}); ((\<lambda>x. F (\<gamma> x) \<bullet> i * vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}\<rbrakk> \<Longrightarrow> ((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
by (metis (no_types, lifting) gamma_differentiable(1))
[PROOF STATE]
proof (state)
this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
[PROOF STEP]
have "(\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) integrable_on {0..1}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}

goal (1 subgoal):
 1. (\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) integrable_on {0..1}
[PROOF STEP]
using integrable_on_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) has_integral integral {pathstart \<gamma> \<bullet> i..pathfinish \<gamma> \<bullet> i} (\<lambda>f_var. F (f_var *\<^sub>R i + g f_var) \<bullet> i)) {0..1}
(?f integrable_on ?i) = (\<exists>y. (?f has_integral y) ?i)

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

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) integrable_on {0..1}
[PROOF STEP]
show "line_integral_exists F {i} \<gamma>"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. F (\<gamma> x) \<bullet> i * (vector_derivative \<gamma> (at x within {0..1}) \<bullet> i)) integrable_on {0..1}

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
by (auto simp add: line_integral_exists_def)
[PROOF STATE]
proof (state)
this:
line_integral_exists F {i} \<gamma>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_prod_le: "degree (\<Prod>i\<in>S. f i) \<le> (\<Sum>i\<in>S. degree (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod f S) \<le> (\<Sum>i\<in>S. degree (f i))
[PROOF STEP]
by (induction S rule: infinite_finite_induct)
     (simp_all, metis (lifting) degree_mult_le dual_order.trans nat_add_left_cancel_le)


[STATEMENT]
lemma sum_in_Ints: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<int>) \<Longrightarrow> sum f A \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<int>) \<Longrightarrow> sum f A \<in> \<int>
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma sorted_map: "\<lbrakk> sorted xs; mono f \<rbrakk> \<Longrightarrow> sorted (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; mono f\<rbrakk> \<Longrightarrow> sorted (map f xs)
[PROOF STEP]
by (simp add: monoD sorted_iff_nth_mono)


[STATEMENT]
lemma connectedI_const:
  "(\<And>P::'a::topological_space \<Rightarrow> bool. continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c) \<Longrightarrow> connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c) \<Longrightarrow> connected S
[PROOF STEP]
by (auto simp: connected_iff_const)


[STATEMENT]
lemma ideal_eq_right_ideal: "ideal I = right_ideal I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal I = right_ideal I
[PROOF STEP]
by (metis ideal_def left_ideal_eq_right_ideal)


[STATEMENT]
lemma lq_prod: "u \<le>p v\<cdot>u \<Longrightarrow> u \<le>p w \<Longrightarrow>  u\<inverse>\<^sup>>(v\<cdot>u)\<cdot>u\<inverse>\<^sup>>w = u\<inverse>\<^sup>>(v\<cdot>w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<le>p v \<cdot> u; u \<le>p w\<rbrakk> \<Longrightarrow> u\<inverse>\<^sup>>(v \<cdot> u) \<cdot> u\<inverse>\<^sup>>w = u\<inverse>\<^sup>>(v \<cdot> w)
[PROOF STEP]
using lq_reassoc[of u "v \<cdot> u" "u\<inverse>\<^sup>>w"] lq_rq_reassoc_suf[of u w "v \<cdot> u", unfolded rq_triv[of v u]]
[PROOF STATE]
proof (prove)
using this:
u \<le>p v \<cdot> u \<Longrightarrow> u\<inverse>\<^sup>>(v \<cdot> u) \<cdot> u\<inverse>\<^sup>>w = u\<inverse>\<^sup>>((v \<cdot> u) \<cdot> u\<inverse>\<^sup>>w)
\<lbrakk>u \<le>p w; u \<le>s v \<cdot> u\<rbrakk> \<Longrightarrow> (v \<cdot> u) \<cdot> u\<inverse>\<^sup>>w = v \<cdot> w

goal (1 subgoal):
 1. \<lbrakk>u \<le>p v \<cdot> u; u \<le>p w\<rbrakk> \<Longrightarrow> u\<inverse>\<^sup>>(v \<cdot> u) \<cdot> u\<inverse>\<^sup>>w = u\<inverse>\<^sup>>(v \<cdot> w)
[PROOF STEP]
by (simp add: suf_def)


[STATEMENT]
lemma "\<forall>(x::real) (y::real). \<lfloor>x\<rfloor> = \<lfloor>y\<rfloor> \<longrightarrow> 0 \<le> \<bar>y - x\<bar> \<and> \<bar>y - x\<bar> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. \<lfloor>x\<rfloor> = \<lfloor>y\<rfloor> \<longrightarrow> 0 \<le> \<bar>y - x\<bar> \<and> \<bar>y - x\<bar> \<le> 1
[PROOF STEP]
by mir


[STATEMENT]
lemma "123.456 = -111.111 + 200 + 30 + 4 + 5/10 + 6/100 + (7/1000::rat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 123456 / 10 ^ 3 = - (111111 / 10 ^ 3) + 200 + 30 + 4 + 5 / 10 + 6 / 100 + 7 / 1000
[PROOF STEP]
by simp


[STATEMENT]
theorem wls_vsubstEnv_substEnv_compose2:
assumes  "wlsEnv rho" and "wls (asSort ys) Y"
and "ys \<noteq> zs \<or> y \<notin> {z,z1}"
shows "((rho &[Y / y]_ys) &[z1 // z]_zs) = ((rho &[z1 // z]_zs) &[(Y #[z1 // z]_zs) / y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[Y / y]_ys &[z1 // z]_zs = rho &[z1 // z]_zs &[Y #[z1 // z]_zs / y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
wls (asSort ys) Y
ys \<noteq> zs \<or> y \<notin> {z, z1}

goal (1 subgoal):
 1. rho &[Y / y]_ys &[z1 // z]_zs = rho &[z1 // z]_zs &[Y #[z1 // z]_zs / y]_ys
[PROOF STEP]
by(simp add: vsubstEnv_substEnv_compose2)


[STATEMENT]
lemma sum_upto_cong' [cong]:
  "(\<And>n. n > 0 \<Longrightarrow> real n \<le> x \<Longrightarrow> f n = f' n) \<Longrightarrow> x = x' \<Longrightarrow> sum_upto f x = sum_upto f' x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. \<lbrakk>0 < n; real n \<le> x\<rbrakk> \<Longrightarrow> f n = f' n; x = x'\<rbrakk> \<Longrightarrow> sum_upto f x = sum_upto f' x'
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. \<lbrakk>0 < n; real n \<le> x\<rbrakk> \<Longrightarrow> f n = f' n; x = x'\<rbrakk> \<Longrightarrow> sum f {i. 0 < i \<and> real i \<le> x} = sum f' {i. 0 < i \<and> real i \<le> x'}
[PROOF STEP]
by (intro sum.cong) auto


[STATEMENT]
lemma "rat_poly_times p (q + r)
                 = (rat_poly_times p q) + (rat_poly_times p r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times p (rat_poly_plus q r) = rat_poly_plus (rat_poly_times p q) (rat_poly_times p r)
[PROOF STEP]
by (metis rat_poly.plus_left_distributivity)


[STATEMENT]
lemma count_list_replicate: "count_list (replicate x y) y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (replicate x y) y = x
[PROOF STEP]
by (induct x) auto


[STATEMENT]
lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z1 + z2) * w = z1 * w + z2 * w
[PROOF STEP]
by (cases z1, cases z2, cases w) (simp add: real_add real_mult algebra_simps)


[STATEMENT]
lemma emeasure_PiM_exponential_Ioi_sequence:
  assumes R: "summable R" "\<And>i. 0 < R i" "0 \<le> x"
  shows "emeasure (\<Pi>\<^sub>M i\<in>UNIV. exponential (R i)) (\<Pi> i\<in>UNIV. {x<..}) = exp (- x * suminf R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
let ?R = "\<lambda>i. exponential (R i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
let ?P = "\<Pi>\<^sub>M i\<in>UNIV. ?R i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
let ?N = "\<lambda>n::nat. prod_emb UNIV ?R {..<n} (\<Pi>\<^sub>E i\<in>{..<n}. {x<..})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
interpret prob_space ?P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i)))
[PROOF STEP]
by (intro prob_space_PiM prob_space_exponential R)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
have "(\<Pi>\<^sub>M i\<in>UNIV. exponential (R i)) (\<Inter>n. ?N n) = (INF n. (\<Pi>\<^sub>M i\<in>UNIV. exponential (R i)) (?N n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (\<Inter>n. prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})) = (\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})))
[PROOF STEP]
by (intro INF_emeasure_decseq[symmetric] decseq_emb_PiE) (auto simp: incseq_def)
[PROOF STATE]
proof (state)
this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (\<Inter>n. prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})) = (\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (\<Inter>n. prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})) = (\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
have "\<dots> = (INF n. ennreal (exp (- x * (\<Sum>i<n. R i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..}))) = (\<Sqinter>n. ennreal (exp (- x * sum R {..<n})))
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
summable R
0 < R ?i
0 \<le> x

goal (1 subgoal):
 1. (\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..}))) = (\<Sqinter>n. ennreal (exp (- x * sum R {..<n})))
[PROOF STEP]
by (intro INF_cong emeasure_PiM_exponential_Ioi_finite) auto
[PROOF STATE]
proof (state)
this:
(\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..}))) = (\<Sqinter>n. ennreal (exp (- x * sum R {..<n})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sqinter>n. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..}))) = (\<Sqinter>n. ennreal (exp (- x * sum R {..<n})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
have "\<dots> = ennreal (exp (- x * (SUP n. (\<Sum>i<n. R i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>n. ennreal (exp (- x * sum R {..<n}))) = ennreal (exp (- x * (\<Squnion>n. sum R {..<n})))
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
summable R
0 < R ?i
0 \<le> x

goal (1 subgoal):
 1. (\<Sqinter>n. ennreal (exp (- x * sum R {..<n}))) = ennreal (exp (- x * (\<Squnion>n. sum R {..<n})))
[PROOF STEP]
by (subst continuous_at_Sup_antimono[where f="\<lambda>r. ennreal (exp (- x * r))"])
       (auto intro!: bdd_aboveI2[where M="\<Sum>i. R i"] sum_le_suminf summable_mult mult_left_mono
                     continuous_mult continuous_at_ennreal continuous_within_exp[THEN continuous_within_compose3] continuous_minus
             simp: less_imp_le antimono_def image_comp)
[PROOF STATE]
proof (state)
this:
(\<Sqinter>n. ennreal (exp (- x * sum R {..<n}))) = ennreal (exp (- x * (\<Squnion>n. sum R {..<n})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sqinter>n. ennreal (exp (- x * sum R {..<n}))) = ennreal (exp (- x * (\<Squnion>n. sum R {..<n})))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
have "\<dots> = ennreal (exp (- x * (\<Sum>i. R i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (exp (- x * (\<Squnion>n. sum R {..<n}))) = ennreal (exp (- x * (\<Sum>i. R i)))
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
summable R
0 < R ?i
0 \<le> x

goal (1 subgoal):
 1. ennreal (exp (- x * (\<Squnion>n. sum R {..<n}))) = ennreal (exp (- x * (\<Sum>i. R i)))
[PROOF STEP]
by (subst suminf_eq_SUP_real) (auto simp: less_imp_le)
[PROOF STATE]
proof (state)
this:
ennreal (exp (- x * (\<Squnion>n. sum R {..<n}))) = ennreal (exp (- x * (\<Sum>i. R i)))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (exp (- x * (\<Squnion>n. sum R {..<n}))) = ennreal (exp (- x * (\<Sum>i. R i)))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
have "(\<Inter>n. ?N n) = (\<Pi> i\<in>UNIV. {x<..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})) = UNIV \<rightarrow> {x<..}
[PROOF STEP]
by (fastforce simp: prod_emb_def Pi_iff PiE_iff space_exponential)
[PROOF STATE]
proof (state)
this:
(\<Inter>n. prod_emb UNIV (\<lambda>i. exponential (R i)) {..<n} ({..<n} \<rightarrow>\<^sub>E {x<..})) = UNIV \<rightarrow> {x<..}

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * (\<Sum>i. R i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * (\<Sum>i. R i)))

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * (\<Sum>i. R i)))
summable R
0 < R ?i
0 \<le> x

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure (Pi\<^sub>M UNIV (\<lambda>i. exponential (R i))) (UNIV \<rightarrow> {x<..}) = ennreal (exp (- x * suminf R))

goal:
No subgoals!
[PROOF STEP]
qed