[STATEMENT]
lemma sum_list_listset : "as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
have "length as = length As \<Longrightarrow> as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length as = length As; as \<in> listset As\<rbrakk> \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
proof (induct as As rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [] \<in> listset [] \<Longrightarrow> sum_list [] \<in> (\<Sum>A\<leftarrow>[]. A)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs \<in> listset ys \<Longrightarrow> sum_list xs \<in> (\<Sum>A\<leftarrow>ys. A); x # xs \<in> listset (y # ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<in> (\<Sum>A\<leftarrow>y # ys. A)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
[] \<in> listset []

goal (2 subgoals):
 1. [] \<in> listset [] \<Longrightarrow> sum_list [] \<in> (\<Sum>A\<leftarrow>[]. A)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs \<in> listset ys \<Longrightarrow> sum_list xs \<in> (\<Sum>A\<leftarrow>ys. A); x # xs \<in> listset (y # ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<in> (\<Sum>A\<leftarrow>y # ys. A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list [] \<in> (\<Sum>A\<leftarrow>[]. A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list [] \<in> (\<Sum>A\<leftarrow>[]. A)

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs \<in> listset ys \<Longrightarrow> sum_list xs \<in> (\<Sum>A\<leftarrow>ys. A); x # xs \<in> listset (y # ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<in> (\<Sum>A\<leftarrow>y # ys. A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs \<in> listset ys \<Longrightarrow> sum_list xs \<in> (\<Sum>A\<leftarrow>ys. A); x # xs \<in> listset (y # ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<in> (\<Sum>A\<leftarrow>y # ys. A)
[PROOF STEP]
case (Cons a as A As)
[PROOF STATE]
proof (state)
this:
length as = length As
as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
a # as \<in> listset (A # As)

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs \<in> listset ys \<Longrightarrow> sum_list xs \<in> (\<Sum>A\<leftarrow>ys. A); x # xs \<in> listset (y # ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<in> (\<Sum>A\<leftarrow>y # ys. A)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length as = length As
as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
a # as \<in> listset (A # As)

goal (1 subgoal):
 1. sum_list (a # as) \<in> (\<Sum>A\<leftarrow>A # As. A)
[PROOF STEP]
using listset_ConsD[of a] set_plus_def
[PROOF STATE]
proof (prove)
using this:
length as = length As
as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
a # as \<in> listset (A # As)
a # ?xs \<in> listset (?A # ?As) \<Longrightarrow> a \<in> ?A \<and> ?xs \<in> listset ?As
?A + ?B = {c. \<exists>a\<in>?A. \<exists>b\<in>?B. c = a + b}

goal (1 subgoal):
 1. sum_list (a # as) \<in> (\<Sum>A\<leftarrow>A # As. A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (a # as) \<in> (\<Sum>A\<leftarrow>A # As. A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>length as = length As; as \<in> listset As\<rbrakk> \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)

goal (1 subgoal):
 1. as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
thus "as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length as = length As; as \<in> listset As\<rbrakk> \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)

goal (1 subgoal):
 1. as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
using listset_length
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length as = length As; as \<in> listset As\<rbrakk> \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
?xs \<in> listset ?Xs \<Longrightarrow> length ?xs = length ?Xs

goal (1 subgoal):
 1. as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
as \<in> listset As \<Longrightarrow> sum_list as \<in> (\<Sum>A\<leftarrow>As. A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lookup_dflt_map_pair:
  assumes "distinct (map fst xs)" and "snd (f (k, 0)) = 0"
    and "\<And>a b. (fst (f a) = fst (f b)) \<longleftrightarrow> (fst a = fst b)"
  shows "lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
distinct (map fst xs)

goal (1 subgoal):
 1. lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct (map fst []) \<Longrightarrow> lookup_dflt (map_pair f []) (fst (f (k, v))) = snd (f (k, lookup_dflt [] k))
 2. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distinct (map fst [])

goal (2 subgoals):
 1. distinct (map fst []) \<Longrightarrow> lookup_dflt (map_pair f []) (fst (f (k, v))) = snd (f (k, lookup_dflt [] k))
 2. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup_dflt (map_pair f []) (fst (f (k, v))) = snd (f (k, lookup_dflt [] k))
[PROOF STEP]
by (simp add: lookup_dflt_def assms(2))
[PROOF STATE]
proof (state)
this:
lookup_dflt (map_pair f []) (fst (f (k, v))) = snd (f (k, lookup_dflt [] k))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))
distinct (map fst (x # xs))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
obtain k' v' where x: "x = (k', v')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k' v'. x = (k', v') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x = (k', v')

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
obtain k'' v'' where f: "f (k', v') = (k'', v'')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k'' v''. f (k', v') = (k'', v'') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f (k', v') = (k'', v'')

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst (x # xs))
[PROOF STEP]
have "distinct (map fst xs)" and "k' \<notin> fst ` set xs"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst (x # xs))

goal (1 subgoal):
 1. distinct (map fst xs) &&& k' \<notin> fst ` set xs
[PROOF STEP]
by (simp_all add: x)
[PROOF STATE]
proof (state)
this:
distinct (map fst xs)
k' \<notin> fst ` set xs

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
from this(1)
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst xs)
[PROOF STEP]
have eq1: "lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst xs)

goal (1 subgoal):
 1. lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
by (rule Cons(1))
[PROOF STATE]
proof (state)
this:
lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
have eq2: "lookup_dflt ((a, b) # ys) c = (if c = a then b else lookup_dflt ys c)"
    for a b c and ys::"('b \<times> 'e::zero) list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup_dflt ((a, b) # ys) c = (if c = a then b else lookup_dflt ys c)
[PROOF STEP]
by (simp add: lookup_dflt_def map_of_Cons_code)
[PROOF STATE]
proof (state)
this:
lookup_dflt ((?a35, ?b35) # ?ys35) ?c35 = (if ?c35 = ?a35 then ?b35 else lookup_dflt ?ys35 ?c35)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
from \<open>k' \<notin> fst ` set xs\<close>
[PROOF STATE]
proof (chain)
picking this:
k' \<notin> fst ` set xs
[PROOF STEP]
have "map_of xs k' = None"
[PROOF STATE]
proof (prove)
using this:
k' \<notin> fst ` set xs

goal (1 subgoal):
 1. map_of xs k' = None
[PROOF STEP]
by (simp add: map_of_eq_None_iff)
[PROOF STATE]
proof (state)
this:
map_of xs k' = None

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
hence eq3: "lookup_dflt xs k' = 0"
[PROOF STATE]
proof (prove)
using this:
map_of xs k' = None

goal (1 subgoal):
 1. lookup_dflt xs k' = (0::'c)
[PROOF STEP]
by (simp add: lookup_dflt_def)
[PROOF STATE]
proof (state)
this:
lookup_dflt xs k' = (0::'c)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (map fst xs) \<Longrightarrow> lookup_dflt (map_pair f xs) (fst (f (k, v))) = snd (f (k, lookup_dflt xs k)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> lookup_dflt (map_pair f (a # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (a # xs) k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup_dflt (map_pair f (x # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (x # xs) k))
[PROOF STEP]
proof (simp add: f Let_def x eq1 eq2 eq3, intro conjI impI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) = k''; v'' = (0::'d)\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = (0::'d)
 2. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 3. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
assume "k = k'"
[PROOF STATE]
proof (state)
this:
k = k'

goal (3 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) = k''; v'' = (0::'d)\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = (0::'d)
 2. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 3. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
hence "snd (f (k', 0)) = snd (f (k, 0))"
[PROOF STATE]
proof (prove)
using this:
k = k'

goal (1 subgoal):
 1. snd (f (k', 0::'c)) = snd (f (k, 0::'c))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
snd (f (k', 0::'c)) = snd (f (k, 0::'c))

goal (3 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) = k''; v'' = (0::'d)\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = (0::'d)
 2. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 3. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
snd (f (k', 0::'c)) = snd (f (k, 0::'c))

goal (3 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) = k''; v'' = (0::'d)\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = (0::'d)
 2. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 3. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (f (k, 0::'c)) = (0::'d)
[PROOF STEP]
by (fact assms(2))
[PROOF STATE]
proof (state)
this:
snd (f (k, 0::'c)) = (0::'d)

goal (3 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) = k''; v'' = (0::'d)\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = (0::'d)
 2. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 3. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
snd (f (k', 0::'c)) = (0::'d)
[PROOF STEP]
show "snd (f (k', 0)) = 0"
[PROOF STATE]
proof (prove)
using this:
snd (f (k', 0::'c)) = (0::'d)

goal (1 subgoal):
 1. snd (f (k', 0::'c)) = (0::'d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
snd (f (k', 0::'c)) = (0::'d)

goal (2 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 2. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 2. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
assume "fst (f (k', v)) \<noteq> k''"
[PROOF STATE]
proof (state)
this:
fst (f (k', v)) \<noteq> k''

goal (2 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 2. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
hence "fst (f (k', v)) \<noteq> fst (f (k', v'))"
[PROOF STATE]
proof (prove)
using this:
fst (f (k', v)) \<noteq> k''

goal (1 subgoal):
 1. fst (f (k', v)) \<noteq> fst (f (k', v'))
[PROOF STEP]
by (simp add: f)
[PROOF STATE]
proof (state)
this:
fst (f (k', v)) \<noteq> fst (f (k', v'))

goal (2 subgoals):
 1. \<lbrakk>k = k'; fst (f (k', v)) \<noteq> k''\<rbrakk> \<Longrightarrow> snd (f (k', 0::'c)) = v''
 2. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
thus "snd (f (k', 0)) = v''"
[PROOF STATE]
proof (prove)
using this:
fst (f (k', v)) \<noteq> fst (f (k', v'))

goal (1 subgoal):
 1. snd (f (k', 0::'c)) = v''
[PROOF STEP]
by (simp add: assms(3))
[PROOF STATE]
proof (state)
this:
snd (f (k', 0::'c)) = v''

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
assume "k \<noteq> k'"
[PROOF STATE]
proof (state)
this:
k \<noteq> k'

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
assume "fst (f (k, v)) = k''"
[PROOF STATE]
proof (state)
this:
fst (f (k, v)) = k''

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst (f (k, v)) = k''

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
have "... = fst (f (k', v'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k'' = fst (f (k', v'))
[PROOF STEP]
by (simp add: f)
[PROOF STATE]
proof (state)
this:
k'' = fst (f (k', v'))

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fst (f (k, v)) = fst (f (k', v'))
[PROOF STEP]
have "k = k'"
[PROOF STATE]
proof (prove)
using this:
fst (f (k, v)) = fst (f (k', v'))

goal (1 subgoal):
 1. k = k'
[PROOF STEP]
by (simp add: assms(3))
[PROOF STATE]
proof (state)
this:
k = k'

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> k'; fst (f (k, v)) = k''; v'' \<noteq> (0::'d)\<rbrakk> \<Longrightarrow> v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
with \<open>k \<noteq> k'\<close>
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> k'
k = k'
[PROOF STEP]
show "v'' = snd (f (k, lookup_dflt xs k))"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> k'
k = k'

goal (1 subgoal):
 1. v'' = snd (f (k, lookup_dflt xs k))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
v'' = snd (f (k, lookup_dflt xs k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lookup_dflt (map_pair f (x # xs)) (fst (f (k, v))) = snd (f (k, lookup_dflt (x # xs) k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma blinfun_bij2:
  fixes f::"'a \<Rightarrow>\<^sub>L 'a::euclidean_space"
  assumes "f o\<^sub>L g = id_blinfun"
  shows "bij (blinfun_apply g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (blinfun_apply g)
[PROOF STEP]
proof (rule bijI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj (blinfun_apply g)
 2. surj (blinfun_apply g)
[PROOF STEP]
show "inj g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (blinfun_apply g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f o\<^sub>L g = id_blinfun

goal (1 subgoal):
 1. inj (blinfun_apply g)
[PROOF STEP]
by (metis blinfun_apply_id_blinfun blinfun_compose.rep_eq injI inj_on_imageI2)
[PROOF STATE]
proof (state)
this:
inj (blinfun_apply g)

goal (1 subgoal):
 1. surj (blinfun_apply g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj (blinfun_apply g)
[PROOF STEP]
show "surj g"
[PROOF STATE]
proof (prove)
using this:
inj (blinfun_apply g)

goal (1 subgoal):
 1. surj (blinfun_apply g)
[PROOF STEP]
using blinfun.bounded_linear_right bounded_linear_def linear_inj_imp_surj
[PROOF STATE]
proof (prove)
using this:
inj (blinfun_apply g)
bounded_linear (blinfun_apply ?a)
bounded_linear ?f \<equiv> linear ?f \<and> bounded_linear_axioms ?f
\<lbrakk>linear ?f; inj ?f\<rbrakk> \<Longrightarrow> surj ?f

goal (1 subgoal):
 1. surj (blinfun_apply g)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
surj (blinfun_apply g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthogonal_matrix_is_orthogonal:
  fixes A::"real^'n^'n"
  assumes o: "orthogonal_matrix A"
  shows "(pairwise orthogonal (columns A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal (columns A)
[PROOF STEP]
proof (unfold pairwise_def columns_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
assume column_i_not_j: "column i A \<noteq> column j A"
[PROOF STATE]
proof (state)
this:
column i A \<noteq> column j A

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
hence i_not_j: "i \<noteq> j"
[PROOF STATE]
proof (prove)
using this:
column i A \<noteq> column j A

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

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
have "0 = (mat 1) $ i $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) = mat (1::'a) $ i $ j
[PROOF STEP]
by (metis i_not_j mat_1_fun)
[PROOF STATE]
proof (state)
this:
(0::?'a1) = mat (1::?'a1) $ i $ j

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::?'a1) = mat (1::?'a1) $ i $ j

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
have "... = (transpose A ** A) $ i $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 1 $ i $ j = (Finite_Cartesian_Product.transpose A ** A) $ i $ j
[PROOF STEP]
using o
[PROOF STATE]
proof (prove)
using this:
orthogonal_matrix A

goal (1 subgoal):
 1. mat 1 $ i $ j = (Finite_Cartesian_Product.transpose A ** A) $ i $ j
[PROOF STEP]
unfolding orthogonal_matrix
[PROOF STATE]
proof (prove)
using this:
Finite_Cartesian_Product.transpose A ** A = mat 1

goal (1 subgoal):
 1. mat 1 $ i $ j = (Finite_Cartesian_Product.transpose A ** A) $ i $ j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat 1 $ i $ j = (Finite_Cartesian_Product.transpose A ** A) $ i $ j

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat 1 $ i $ j = (Finite_Cartesian_Product.transpose A ** A) $ i $ j

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
have "... = row i (transpose A) \<bullet> column j A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose A ** A) $ i $ j = row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A
[PROOF STEP]
unfolding matrix_matrix_mult_inner_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A = row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose A ** A) $ i $ j = row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose A ** A) $ i $ j = row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
have "... = column i A \<bullet> column j A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A = column i A \<bullet> column j A
[PROOF STEP]
unfolding row_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i A \<bullet> column j A = column i A \<bullet> column j A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
row i (Finite_Cartesian_Product.transpose A) \<bullet> column j A = column i A \<bullet> column j A

goal (1 subgoal):
 1. \<And>i ia. column i A \<noteq> column ia A \<Longrightarrow> orthogonal (column i A) (column ia A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 = column i A \<bullet> column j A
[PROOF STEP]
show "orthogonal (column i A) (column j A)"
[PROOF STATE]
proof (prove)
using this:
0 = column i A \<bullet> column j A

goal (1 subgoal):
 1. orthogonal (column i A) (column j A)
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
using this:
0 = column i A \<bullet> column j A

goal (1 subgoal):
 1. column i A \<bullet> column j A = 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
orthogonal (column i A) (column j A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_nth_scale:
  "fds_nth (fds_scale c f) n =
     (if n > 0 \<and> is_nth_power c n then fds_nth f (nth_root_nat c n) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_scale c f) n = (if 0 < n \<and> is_nth_power c n then fds_nth f (nth_root_nat c n) else (0::'a))
[PROOF STEP]
by (cases "c = 0") (auto simp: is_nth_power_def)


[STATEMENT]
lemma dghm_comp_ArrMap_vrange[dg_cs_intros]:
  assumes "\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<R>\<^sub>\<circ> ((\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Arr\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^bsub>\<alpha>\<^esub> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Arr\<rparr>
[PROOF STEP]
by
    (
      cs_concl cs_shallow
        cs_simp: dghm_comp_components
        cs_intro: is_dghm.dghm_ArrMap_vrange V_cs_intros
    )


[STATEMENT]
lemma canon_ang_eqE:
  assumes "\<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft>"
  shows "\<exists> (k::int). \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 *k * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi
[PROOF STEP]
obtain k1 k2 :: int where
    "\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = 2 * k1 * pi"
    "\<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = 2 * k2 * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k1 k2. \<lbrakk>\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = real_of_int (2 * k1) * pi; \<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = real_of_int (2 * k2) * pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using canon_ang[of \<alpha>\<^sub>1] canon_ang[of \<alpha>\<^sub>2]
[PROOF STATE]
proof (prove)
using this:
- pi < \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft>
\<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> \<le> pi
\<exists>x. \<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = 2 * real_of_int x * pi
- pi < \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft>
\<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> \<le> pi
\<exists>x. \<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = 2 * real_of_int x * pi

goal (1 subgoal):
 1. (\<And>k1 k2. \<lbrakk>\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = real_of_int (2 * k1) * pi; \<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = real_of_int (2 * k2) * pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = real_of_int (2 * k1) * pi
\<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = real_of_int (2 * k2) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = real_of_int (2 * k1) * pi
\<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = real_of_int (2 * k2) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<alpha>\<^sub>1 - \<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = real_of_int (2 * k1) * pi
\<alpha>\<^sub>2 - \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft> = real_of_int (2 * k2) * pi
\<downharpoonright>\<alpha>\<^sub>1\<downharpoonleft> = \<downharpoonright>\<alpha>\<^sub>2\<downharpoonleft>

goal (1 subgoal):
 1. \<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi
[PROOF STEP]
by (rule_tac x="k1 - k2" in exI) (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<exists>x. \<alpha>\<^sub>1 - \<alpha>\<^sub>2 = 2 * real_of_int x * pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphism_grouping_point_2:
  fixes a::real and w::real
  assumes hom_ab: "homeomorphism (cbox a b) (cbox u v) f1 g1"
      and hom_bc: "homeomorphism (cbox b c) (cbox v w) f2 g2"
      and "b \<in> cbox a c" "v \<in> cbox u w"
      and eq: "f1 a = u" "f1 b = v" "f2 b = v" "f2 c = w"
 obtains f g where "homeomorphism (cbox a c) (cbox u w) f g" "f a = u" "f c = w"
                   "\<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x" "\<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have le: "a \<le> b" "b \<le> c" "u \<le> v" "v \<le> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b &&& b \<le> c) &&& u \<le> v &&& v \<le> w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homeomorphism (cbox a b) (cbox u v) f1 g1
homeomorphism (cbox b c) (cbox v w) f2 g2
b \<in> cbox a c
v \<in> cbox u w
f1 a = u
f1 b = v
f2 b = v
f2 c = w

goal (1 subgoal):
 1. (a \<le> b &&& b \<le> c) &&& u \<le> v &&& v \<le> w
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
a \<le> b
b \<le> c
u \<le> v
v \<le> w

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
b \<le> c
u \<le> v
v \<le> w
[PROOF STEP]
have ac: "cbox a c = cbox a b \<union> cbox b c" and uw: "cbox u w = cbox u v \<union> cbox v w"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
b \<le> c
u \<le> v
v \<le> w

goal (1 subgoal):
 1. cbox a c = cbox a b \<union> cbox b c &&& cbox u w = cbox u v \<union> cbox v w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cbox a c = cbox a b \<union> cbox b c
cbox u w = cbox u v \<union> cbox v w

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define f where "f \<equiv> \<lambda>x. if x \<le> b then f1 x else f2 x"
[PROOF STATE]
proof (state)
this:
f \<equiv> \<lambda>x. if x \<le> b then f1 x else f2 x

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<exists>g. homeomorphism (cbox a c) (cbox u w) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. homeomorphism (cbox a c) (cbox u w) f g
[PROOF STEP]
proof (rule homeomorphism_compact)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. compact (cbox a c)
 2. continuous_on (cbox a c) f
 3. f ` cbox a c = cbox u w
 4. inj_on f (cbox a c)
[PROOF STEP]
have cf1: "continuous_on (cbox a b) f1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (cbox a b) f1
[PROOF STEP]
using hom_ab homeomorphism_cont1
[PROOF STATE]
proof (prove)
using this:
homeomorphism (cbox a b) (cbox u v) f1 g1
homeomorphism ?S ?T ?f ?g \<Longrightarrow> continuous_on ?S ?f

goal (1 subgoal):
 1. continuous_on (cbox a b) f1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (cbox a b) f1

goal (4 subgoals):
 1. compact (cbox a c)
 2. continuous_on (cbox a c) f
 3. f ` cbox a c = cbox u w
 4. inj_on f (cbox a c)
[PROOF STEP]
have cf2: "continuous_on (cbox b c) f2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (cbox b c) f2
[PROOF STEP]
using hom_bc homeomorphism_cont1
[PROOF STATE]
proof (prove)
using this:
homeomorphism (cbox b c) (cbox v w) f2 g2
homeomorphism ?S ?T ?f ?g \<Longrightarrow> continuous_on ?S ?f

goal (1 subgoal):
 1. continuous_on (cbox b c) f2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (cbox b c) f2

goal (4 subgoals):
 1. compact (cbox a c)
 2. continuous_on (cbox a c) f
 3. f ` cbox a c = cbox u w
 4. inj_on f (cbox a c)
[PROOF STEP]
show "continuous_on (cbox a c) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (cbox a c) f
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (cbox a c) (\<lambda>x. if x \<le> b then f1 x else f2 x)
[PROOF STEP]
using le eq
[PROOF STATE]
proof (prove)
using this:
a \<le> b
b \<le> c
u \<le> v
v \<le> w
f1 a = u
f1 b = v
f2 b = v
f2 c = w

goal (1 subgoal):
 1. continuous_on (cbox a c) (\<lambda>x. if x \<le> b then f1 x else f2 x)
[PROOF STEP]
by (force intro: continuous_on_cases_le [OF continuous_on_subset [OF cf1] continuous_on_subset [OF cf2]])
[PROOF STATE]
proof (state)
this:
continuous_on (cbox a c) f

goal (3 subgoals):
 1. compact (cbox a c)
 2. f ` cbox a c = cbox u w
 3. inj_on f (cbox a c)
[PROOF STEP]
have "f ` cbox a b = f1 ` cbox a b" "f ` cbox b c = f2 ` cbox b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` cbox a b = f1 ` cbox a b &&& f ` cbox b c = f2 ` cbox b c
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> b then f1 x else f2 x) ` cbox a b = f1 ` cbox a b &&& (\<lambda>x. if x \<le> b then f1 x else f2 x) ` cbox b c = f2 ` cbox b c
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
f1 a = u
f1 b = v
f2 b = v
f2 c = w

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> b then f1 x else f2 x) ` cbox a b = f1 ` cbox a b &&& (\<lambda>x. if x \<le> b then f1 x else f2 x) ` cbox b c = f2 ` cbox b c
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
f ` cbox a b = f1 ` cbox a b
f ` cbox b c = f2 ` cbox b c

goal (3 subgoals):
 1. compact (cbox a c)
 2. f ` cbox a c = cbox u w
 3. inj_on f (cbox a c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` cbox a b = f1 ` cbox a b
f ` cbox b c = f2 ` cbox b c
[PROOF STEP]
show "f ` cbox a c = cbox u w"
[PROOF STATE]
proof (prove)
using this:
f ` cbox a b = f1 ` cbox a b
f ` cbox b c = f2 ` cbox b c

goal (1 subgoal):
 1. f ` cbox a c = cbox u w
[PROOF STEP]
unfolding ac uw image_Un
[PROOF STATE]
proof (prove)
using this:
f ` cbox a b = f1 ` cbox a b
f ` cbox b c = f2 ` cbox b c

goal (1 subgoal):
 1. f ` cbox a b \<union> f ` cbox b c = cbox u v \<union> cbox v w
[PROOF STEP]
by (metis hom_ab hom_bc homeomorphism_def)
[PROOF STATE]
proof (state)
this:
f ` cbox a c = cbox u w

goal (2 subgoals):
 1. compact (cbox a c)
 2. inj_on f (cbox a c)
[PROOF STEP]
have neq12: "f1 x \<noteq> f2 y" if x: "a \<le> x" "x \<le> b" and y: "b < y" "y \<le> c" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
have "f1 x \<in> cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f1 x \<in> cbox u v
[PROOF STEP]
by (metis hom_ab homeomorphism_def image_eqI mem_box_real(2) x)
[PROOF STATE]
proof (state)
this:
f1 x \<in> cbox u v

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f1 x \<in> cbox u v

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
have "f2 y \<in> cbox v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2 y \<in> cbox v w
[PROOF STEP]
by (metis (full_types) hom_bc homeomorphism_def image_subset_iff mem_box_real(2) not_le not_less_iff_gr_or_eq order_refl y)
[PROOF STATE]
proof (state)
this:
f2 y \<in> cbox v w

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f2 y \<in> cbox v w

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
have "f2 y \<noteq> f2 b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2 y \<noteq> f2 b
[PROOF STEP]
by (metis cancel_comm_monoid_add_class.diff_cancel diff_gt_0_iff_gt hom_bc homeomorphism_def le(2) less_imp_le less_numeral_extra(3) mem_box_real(2) order_refl y)
[PROOF STATE]
proof (state)
this:
f2 y \<noteq> f2 b

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f1 x \<in> cbox u v
f2 y \<in> cbox v w
f2 y \<noteq> f2 b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f1 x \<in> cbox u v
f2 y \<in> cbox v w
f2 y \<noteq> f2 b

goal (1 subgoal):
 1. f1 x \<noteq> f2 y
[PROOF STEP]
using le eq
[PROOF STATE]
proof (prove)
using this:
f1 x \<in> cbox u v
f2 y \<in> cbox v w
f2 y \<noteq> f2 b
a \<le> b
b \<le> c
u \<le> v
v \<le> w
f1 a = u
f1 b = v
f2 b = v
f2 c = w

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> ?x; ?x \<le> b; b < ?y; ?y \<le> c\<rbrakk> \<Longrightarrow> f1 ?x \<noteq> f2 ?y

goal (2 subgoals):
 1. compact (cbox a c)
 2. inj_on f (cbox a c)
[PROOF STEP]
have "inj_on f1 (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f1 (cbox a b)
[PROOF STEP]
by (metis (full_types) hom_ab homeomorphism_def inj_onI)
[PROOF STATE]
proof (state)
this:
inj_on f1 (cbox a b)

goal (2 subgoals):
 1. compact (cbox a c)
 2. inj_on f (cbox a c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on f1 (cbox a b)

goal (2 subgoals):
 1. compact (cbox a c)
 2. inj_on f (cbox a c)
[PROOF STEP]
have "inj_on f2 (cbox b c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f2 (cbox b c)
[PROOF STEP]
by (metis (full_types) hom_bc homeomorphism_def inj_onI)
[PROOF STATE]
proof (state)
this:
inj_on f2 (cbox b c)

goal (2 subgoals):
 1. compact (cbox a c)
 2. inj_on f (cbox a c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on f1 (cbox a b)
inj_on f2 (cbox b c)
[PROOF STEP]
show "inj_on f (cbox a c)"
[PROOF STATE]
proof (prove)
using this:
inj_on f1 (cbox a b)
inj_on f2 (cbox b c)

goal (1 subgoal):
 1. inj_on f (cbox a c)
[PROOF STEP]
apply (simp (no_asm) add: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f1 (cbox a b); inj_on f2 (cbox b c)\<rbrakk> \<Longrightarrow> \<forall>x\<in>{a..c}. \<forall>y\<in>{a..c}. f x = f y \<longrightarrow> x = y
[PROOF STEP]
apply (simp add: f_def inj_on_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f1 {a..b}; inj_on f2 {b..c}\<rbrakk> \<Longrightarrow> \<forall>x\<in>{a..c}. (x \<le> b \<longrightarrow> (\<forall>y\<in>{a..c}. \<not> y \<le> b \<longrightarrow> f1 x \<noteq> f2 y)) \<and> (\<not> x \<le> b \<longrightarrow> (\<forall>y\<in>{a..c}. y \<le> b \<longrightarrow> f2 x \<noteq> f1 y))
[PROOF STEP]
using neq12
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> ?x; ?x \<le> b; b < ?y; ?y \<le> c\<rbrakk> \<Longrightarrow> f1 ?x \<noteq> f2 ?y

goal (1 subgoal):
 1. \<lbrakk>inj_on f1 {a..b}; inj_on f2 {b..c}\<rbrakk> \<Longrightarrow> \<forall>x\<in>{a..c}. (x \<le> b \<longrightarrow> (\<forall>y\<in>{a..c}. \<not> y \<le> b \<longrightarrow> f1 x \<noteq> f2 y)) \<and> (\<not> x \<le> b \<longrightarrow> (\<forall>y\<in>{a..c}. y \<le> b \<longrightarrow> f2 x \<noteq> f1 y))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
inj_on f (cbox a c)

goal (1 subgoal):
 1. compact (cbox a c)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<exists>g. homeomorphism (cbox a c) (cbox u w) f g

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>g. homeomorphism (cbox a c) (cbox u w) f g
[PROOF STEP]
obtain g where "homeomorphism (cbox a c) (cbox u w) f g"
[PROOF STATE]
proof (prove)
using this:
\<exists>g. homeomorphism (cbox a c) (cbox u w) f g

goal (1 subgoal):
 1. (\<And>g. homeomorphism (cbox a c) (cbox u w) f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
homeomorphism (cbox a c) (cbox u w) f g

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>homeomorphism (cbox a c) (cbox u w) f g; f a = u; f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> f x = f2 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homeomorphism (cbox a c) (cbox u w) f g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homeomorphism (cbox a c) (cbox u w) f g

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using eq f_def le that
[PROOF STATE]
proof (prove)
using this:
homeomorphism (cbox a c) (cbox u w) f g
f1 a = u
f1 b = v
f2 b = v
f2 c = w
f \<equiv> \<lambda>x. if x \<le> b then f1 x else f2 x
a \<le> b
b \<le> c
u \<le> v
v \<le> w
\<lbrakk>homeomorphism (cbox a c) (cbox u w) ?f ?g; ?f a = u; ?f c = w; \<And>x. x \<in> cbox a b \<Longrightarrow> ?f x = f1 x; \<And>x. x \<in> cbox b c \<Longrightarrow> ?f x = f2 x\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dims_mat_tensorlist_mult:
assumes "T\<in>set\<^sub>v (mat_tensorlist_mult A Ts ds)"
shows "Tensor.dims T = ds"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims T = ds
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dims T = ds
[PROOF STEP]
obtain j where "T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v (map_vec (\<lambda>T. Tensor.lookup T is) Ts)) $j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using vec_setE[OF assms, unfolded mat_tensorlist_mult_def]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. \<lbrakk>Matrix.vec (dim_row A) (\<lambda>j. tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j)) $ i = T; i < dim_vec (Matrix.vec (dim_row A) (\<lambda>j. tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j)))\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>j. T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis dim_vec index_vec)
[PROOF STATE]
proof (state)
this:
T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j)

goal (1 subgoal):
 1. dims T = ds
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T = tensor_from_lookup ds (\<lambda>is. (A *\<^sub>v map_vec (\<lambda>T. lookup T is) Ts) $ j)

goal (1 subgoal):
 1. dims T = ds
[PROOF STEP]
by (simp add: length_tensor_vec_from_lookup tensor_from_lookup_def)
[PROOF STATE]
proof (state)
this:
dims T = ds

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listset_ConsI: "y \<in> x \<Longrightarrow> ys' \<in> listset xs \<Longrightarrow> ys = y # ys' \<Longrightarrow> ys \<in> listset (x # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> x; ys' \<in> listset xs; ys = y # ys'\<rbrakk> \<Longrightarrow> ys \<in> listset (x # xs)
[PROOF STEP]
by (simp add: set_Cons_def)


[STATEMENT]
lemma valuate_update_x:
  fixes v1 v2 :: "'a::rational_vector valuation"
  assumes "\<forall>y \<in> vars lp. y\<noteq>x \<longrightarrow> v1 y = v2 y"
  shows "lp \<lbrace>v1\<rbrace>  + coeff lp x *R (v2 x - v1 x) = (lp \<lbrace>v2\<rbrace>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lp \<lbrace> v1 \<rbrace> + coeff lp x *R (v2 x - v1 x) = lp \<lbrace> v2 \<rbrace>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>vars lp. y \<noteq> x \<longrightarrow> v1 y = v2 y

goal (1 subgoal):
 1. lp \<lbrace> v1 \<rbrace> + coeff lp x *R (v2 x - v1 x) = lp \<lbrace> v2 \<rbrace>
[PROOF STEP]
unfolding valuate_def vars_def coeff_def
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>map_fun Rep_linear_poly id fun_vars lp. y \<noteq> x \<longrightarrow> v1 y = v2 y

goal (1 subgoal):
 1. map_fun Rep_linear_poly id fun_valuate lp v1 + map_fun Rep_linear_poly id fun_coeff lp x *R (v2 x - v1 x) = map_fun Rep_linear_poly id fun_valuate lp v2
[PROOF STEP]
using valuate_update_x_lemma[of "Rep_linear_poly lp" x v1 v2] Rep_linear_poly
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>map_fun Rep_linear_poly id fun_vars lp. y \<noteq> x \<longrightarrow> v1 y = v2 y
\<lbrakk>\<forall>y. Rep_linear_poly lp y \<noteq> 0 \<longrightarrow> y \<noteq> x \<longrightarrow> v1 y = v2 y; finite {v. Rep_linear_poly lp v \<noteq> 0}\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>{v. Rep_linear_poly lp v \<noteq> 0}. Rep_linear_poly lp x *R v1 x) + Rep_linear_poly lp x *R (v2 x - v1 x) = (\<Sum>x\<in>{v. Rep_linear_poly lp v \<noteq> 0}. Rep_linear_poly lp x *R v2 x)
Rep_linear_poly ?x \<in> {c. Abstract_Linear_Poly.inv c}

goal (1 subgoal):
 1. map_fun Rep_linear_poly id fun_valuate lp v1 + map_fun Rep_linear_poly id fun_coeff lp x *R (v2 x - v1 x) = map_fun Rep_linear_poly id fun_valuate lp v2
[PROOF STEP]
by auto


[STATEMENT]
lemma v_1_iff_i_0: "$v = 1 \<longleftrightarrow> i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($v = 1) = (i = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. $v = 1 \<Longrightarrow> i = 0
 2. i = 0 \<Longrightarrow> $v = 1
[PROOF STEP]
assume "$v = 1"
[PROOF STATE]
proof (state)
this:
$v = 1

goal (2 subgoals):
 1. $v = 1 \<Longrightarrow> i = 0
 2. i = 0 \<Longrightarrow> $v = 1
[PROOF STEP]
thus "i = 0"
[PROOF STATE]
proof (prove)
using this:
$v = 1

goal (1 subgoal):
 1. i = 0
[PROOF STEP]
unfolding v_pres_def
[PROOF STATE]
proof (prove)
using this:
1 / (1 + i) = 1

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

goal (1 subgoal):
 1. i = 0 \<Longrightarrow> $v = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i = 0 \<Longrightarrow> $v = 1
[PROOF STEP]
assume "i = 0"
[PROOF STATE]
proof (state)
this:
i = 0

goal (1 subgoal):
 1. i = 0 \<Longrightarrow> $v = 1
[PROOF STEP]
thus "$v = 1"
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. $v = 1
[PROOF STEP]
unfolding v_pres_def
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. 1 / (1 + i) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
$v = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ale_neq_less:"\<lbrakk> (x::ant)\<le> y; x \<noteq> y\<rbrakk> \<Longrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; x \<noteq> y\<rbrakk> \<Longrightarrow> x < y
[PROOF STEP]
apply (simp add:less_ant_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma range_decompress:
  assumes "x\<in>{0..2^d - 1}" "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "decompress d x \<in> {0..q-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decompress d x \<in> {0..q - 1}
[PROOF STEP]
using decompress_def assms
[PROOF STATE]
proof (prove)
using this:
decompress ?d ?x = round (real_of_int q * real_of_int ?x / real_of_int 2 ^ ?d)
x \<in> {0..2 ^ d - 1}
int d < \<lceil>log 2 (real_of_int q)\<rceil>

goal (1 subgoal):
 1. decompress d x \<in> {0..q - 1}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> 0 \<le> round (real_of_int q * real_of_int x / 2 ^ d)
 2. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
decompress ?d ?x = round (real_of_int q * real_of_int ?x / 2 ^ ?d)
int d < \<lceil>log 2 (real_of_int q)\<rceil>
0 \<le> x
x < 2 ^ d

goal (2 subgoals):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> 0 \<le> round (real_of_int q * real_of_int x / 2 ^ d)
 2. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
decompress ?d ?x = round (real_of_int q * real_of_int ?x / 2 ^ ?d)
int d < \<lceil>log 2 (real_of_int q)\<rceil>
0 \<le> x
x < 2 ^ d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
decompress ?d ?x = round (real_of_int q * real_of_int ?x / 2 ^ ?d)
int d < \<lceil>log 2 (real_of_int q)\<rceil>
0 \<le> x
x < 2 ^ d

goal (1 subgoal):
 1. 0 \<le> round (real_of_int q * real_of_int x / 2 ^ d)
[PROOF STEP]
by (smt (verit, best) divide_eq_0_iff divide_numeral_1
    less_divide_eq_1_pos mult_of_int_commute
    nonzero_mult_div_cancel_right of_int_eq_0_iff
    of_int_less_1_iff powr_realpow q_gt_zero q_nonzero
    round_0 round_mono twod_lt_q zero_less_power)
[PROOF STATE]
proof (state)
this:
0 \<le> round (real_of_int q * real_of_int x / 2 ^ d)

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
decompress ?d ?x = round (real_of_int q * real_of_int ?x / 2 ^ ?d)
int d < \<lceil>log 2 (real_of_int q)\<rceil>
0 \<le> x
x < 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
have "real_of_int q/2^d > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < real_of_int q / 2 ^ d
[PROOF STEP]
using twod_lt_q[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
2 powr real d < real_of_int q

goal (1 subgoal):
 1. 1 < real_of_int q / 2 ^ d
[PROOF STEP]
by (simp add: powr_realpow)
[PROOF STATE]
proof (state)
this:
1 < real_of_int q / 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < real_of_int q / 2 ^ d
[PROOF STEP]
have log: "real_of_int q - real_of_int q/2^d \<le> q-1"
[PROOF STATE]
proof (prove)
using this:
1 < real_of_int q / 2 ^ d

goal (1 subgoal):
 1. real_of_int q - real_of_int q / 2 ^ d \<le> real_of_int (q - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int q - real_of_int q / 2 ^ d \<le> real_of_int (q - 1)

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
have "x \<le> 2^d-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 2 ^ d - 1
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..2 ^ d - 1}

goal (1 subgoal):
 1. x \<le> 2 ^ d - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> 2 ^ d - 1

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> 2 ^ d - 1
[PROOF STEP]
have "real_of_int x \<le> 2^d - 1"
[PROOF STATE]
proof (prove)
using this:
x \<le> 2 ^ d - 1

goal (1 subgoal):
 1. real_of_int x \<le> 2 ^ d - 1
[PROOF STEP]
by (simp add: int_less_real_le)
[PROOF STATE]
proof (state)
this:
real_of_int x \<le> 2 ^ d - 1

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int x \<le> 2 ^ d - 1
[PROOF STEP]
have "real_of_int q * real_of_int x / 2^d \<le>
    real_of_int q * (2^d-1) / 2^d"
[PROOF STATE]
proof (prove)
using this:
real_of_int x \<le> 2 ^ d - 1

goal (1 subgoal):
 1. real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q * (2 ^ d - 1) / 2 ^ d
[PROOF STEP]
by (smt (verit, best) divide_strict_right_mono
      mult_less_cancel_left_pos of_int_pos q_gt_zero
      zero_less_power)
[PROOF STATE]
proof (state)
this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q * (2 ^ d - 1) / 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q * (2 ^ d - 1) / 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
have "\<dots> = real_of_int q * 2^d /2^d - real_of_int q/2^d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int q * (2 ^ d - 1) / 2 ^ d = real_of_int q * 2 ^ d / 2 ^ d - real_of_int q / 2 ^ d
[PROOF STEP]
by (simp add: diff_divide_distrib right_diff_distrib)
[PROOF STATE]
proof (state)
this:
real_of_int q * (2 ^ d - 1) / 2 ^ d = real_of_int q * 2 ^ d / 2 ^ d - real_of_int q / 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q * 2 ^ d / 2 ^ d - real_of_int q / 2 ^ d
[PROOF STEP]
have "real_of_int q * real_of_int x / 2^d \<le>
    real_of_int q - real_of_int q/2^d"
[PROOF STATE]
proof (prove)
using this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q * 2 ^ d / 2 ^ d - real_of_int q / 2 ^ d

goal (1 subgoal):
 1. real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q - real_of_int q / 2 ^ d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q - real_of_int q / 2 ^ d

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q - real_of_int q / 2 ^ d
[PROOF STEP]
have "round (real_of_int q * real_of_int x / 2^d) \<le>
    round (real_of_int q - real_of_int q/2^d)"
[PROOF STATE]
proof (prove)
using this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q - real_of_int q / 2 ^ d

goal (1 subgoal):
 1. round (real_of_int q * real_of_int x / 2 ^ d) \<le> round (real_of_int q - real_of_int q / 2 ^ d)
[PROOF STEP]
using round_mono
[PROOF STATE]
proof (prove)
using this:
real_of_int q * real_of_int x / 2 ^ d \<le> real_of_int q - real_of_int q / 2 ^ d
?x \<le> ?y \<Longrightarrow> round ?x \<le> round ?y

goal (1 subgoal):
 1. round (real_of_int q * real_of_int x / 2 ^ d) \<le> round (real_of_int q - real_of_int q / 2 ^ d)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
round (real_of_int q * real_of_int x / 2 ^ d) \<le> round (real_of_int q - real_of_int q / 2 ^ d)

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
round (real_of_int q * real_of_int x / 2 ^ d) \<le> round (real_of_int q - real_of_int q / 2 ^ d)

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
have "\<dots> \<le> q - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round (real_of_int q - real_of_int q / 2 ^ d) \<le> q - 1
[PROOF STEP]
using log
[PROOF STATE]
proof (prove)
using this:
real_of_int q - real_of_int q / 2 ^ d \<le> real_of_int (q - 1)

goal (1 subgoal):
 1. round (real_of_int q - real_of_int q / 2 ^ d) \<le> q - 1
[PROOF STEP]
by (metis round_mono round_of_int)
[PROOF STATE]
proof (state)
this:
round (real_of_int q - real_of_int q / 2 ^ d) \<le> q - 1

goal (1 subgoal):
 1. \<lbrakk>\<And>d x. decompress d x = round (real_of_int q * real_of_int x / 2 ^ d); int d < \<lceil>log 2 (real_of_int q)\<rceil>; 0 \<le> x; x < 2 ^ d\<rbrakk> \<Longrightarrow> round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
round (real_of_int q * real_of_int x / 2 ^ d) \<le> q - 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
round (real_of_int q * real_of_int x / 2 ^ d) \<le> q - 1

goal (1 subgoal):
 1. round (real_of_int q * real_of_int x / 2 ^ d) < q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
round (real_of_int q * real_of_int x / 2 ^ d) < q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma median_const:
  assumes "k > 0"
  shows "median k (\<lambda>i \<in> {0..<k}. a) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
have b: "sorted (map (\<lambda>_. a) [0..<k])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (\<lambda>_. a) [0..<k])
[PROOF STEP]
by (subst sorted_wrt_map, simp)
[PROOF STATE]
proof (state)
this:
sorted (map (\<lambda>_. a) [0..<k])

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
have a: "sort (map (\<lambda>_. a) [0..<k]) = map (\<lambda>_. a) [0..<k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort (map (\<lambda>_. a) [0..<k]) = map (\<lambda>_. a) [0..<k]
[PROOF STEP]
by (subst sorted_sort_id[OF b], simp)
[PROOF STATE]
proof (state)
this:
sort (map (\<lambda>_. a) [0..<k]) = map (\<lambda>_. a) [0..<k]

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
have "median k (\<lambda>i \<in> {0..<k}. a) = median k (\<lambda>_. a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = median k (\<lambda>_. a)
[PROOF STEP]
by (subst median_restrict, simp)
[PROOF STATE]
proof (state)
this:
median k (\<lambda>i\<in>{0..<k}. a) = median k (\<lambda>_. a)

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
median k (\<lambda>i\<in>{0..<k}. a) = median k (\<lambda>_. a)

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
have "... = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. median k (\<lambda>_. a) = a
[PROOF STEP]
apply (simp add:median_def a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>_. a) [0..<k] ! (k div 2) = a
[PROOF STEP]
apply (subst nth_map)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. k div 2 < length [0..<k]
 2. a = a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (2 subgoals):
 1. k div 2 < length [0..<k]
 2. a = a
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
median k (\<lambda>_. a) = a

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
median k (\<lambda>i\<in>{0..<k}. a) = a

goal (1 subgoal):
 1. median k (\<lambda>i\<in>{0..<k}. a) = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
median k (\<lambda>i\<in>{0..<k}. a) = a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_list_disj_Uni : "evalUni (list_disj_Uni L) x = (\<exists>l\<in>set(L). evalUni l x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evalUni (list_disj_Uni L) x = (\<exists>l\<in>set L. evalUni l x)
[PROOF STEP]
by(induction L)(auto)


[STATEMENT]
lemma swap_row_to_front_det: "A \<in> carrier_mat n n \<Longrightarrow> I < n \<Longrightarrow> det (swap_row_to_front A I)
  = (-1)^I * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A
[PROOF STEP]
proof (induct I arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
case (Suc I A)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front ?A I) = (- (1::'a)) ^ I * det ?A
A \<in> carrier_mat n n
Suc I < n

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
from Suc(3)
[PROOF STATE]
proof (chain)
picking this:
Suc I < n
[PROOF STEP]
have I: "I < n"
[PROOF STATE]
proof (prove)
using this:
Suc I < n

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

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
let ?I = "Suc I"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
let ?A = "swaprows I ?I A"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
have AA: "?A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows I (Suc I) A \<in> carrier_mat n n
[PROOF STEP]
using Suc(2)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. swaprows I (Suc I) A \<in> carrier_mat n n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
swaprows I (Suc I) A \<in> carrier_mat n n

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
have "det (swap_row_to_front A (Suc I)) = det (swap_row_to_front ?A I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swap_row_to_front A (Suc I)) = det (swap_row_to_front (swaprows I (Suc I) A) I)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (swap_row_to_front A (Suc I)) = det (swap_row_to_front (swaprows I (Suc I) A) I)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (swap_row_to_front A (Suc I)) = det (swap_row_to_front (swaprows I (Suc I) A) I)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
have "\<dots> = (-1)^I * det ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swap_row_to_front (swaprows I (Suc I) A) I) = (- (1::'a)) ^ I * det (swaprows I (Suc I) A)
[PROOF STEP]
by (rule Suc(1)[OF AA I])
[PROOF STATE]
proof (state)
this:
det (swap_row_to_front (swaprows I (Suc I) A) I) = (- (1::'a)) ^ I * det (swaprows I (Suc I) A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (swap_row_to_front (swaprows I (Suc I) A) I) = (- (1::'a)) ^ I * det (swaprows I (Suc I) A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
have "det ?A = -1 * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows I (Suc I) A) = - (1::'a) * det A
[PROOF STEP]
using det_swaprows[OF I Suc(3) _ Suc(2)]
[PROOF STATE]
proof (prove)
using this:
I \<noteq> Suc I \<Longrightarrow> det (swaprows I (Suc I) A) = - det A

goal (1 subgoal):
 1. det (swaprows I (Suc I) A) = - (1::'a) * det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (swaprows I (Suc I) A) = - (1::'a) * det A

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
 2. \<And>I A. \<lbrakk>\<And>A. \<lbrakk>A \<in> carrier_mat n n; I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A I) = (- (1::'a)) ^ I * det A; A \<in> carrier_mat n n; Suc I < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ I * (- (1::'a) * det A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ I * (- (1::'a) * det A)

goal (1 subgoal):
 1. det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (swap_row_to_front A (Suc I)) = (- (1::'a)) ^ Suc I * det A

goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat n n; 0 < n\<rbrakk> \<Longrightarrow> det (swap_row_to_front A 0) = (- (1::'a)) ^ 0 * det A
[PROOF STEP]
qed simp


[STATEMENT]
lemma continuous_at_of_ereal:
  "\<bar>x0 :: ereal\<bar> \<noteq> \<infinity> \<Longrightarrow> continuous (at x0) real_of_ereal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x0\<bar> \<noteq> \<infinity> \<Longrightarrow> isCont real_of_ereal x0
[PROOF STEP]
unfolding continuous_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x0\<bar> \<noteq> \<infinity> \<Longrightarrow> real_of_ereal \<midarrow>x0\<rightarrow> real_of_ereal x0
[PROOF STEP]
by (rule lim_real_of_ereal) (simp add: ereal_real)


[STATEMENT]
lemma emeasure_bind_const:
    "space M \<noteq> {} \<Longrightarrow> X \<in> sets N \<Longrightarrow> subprob_space N \<Longrightarrow>
         emeasure (M \<bind> (\<lambda>x. N)) X = emeasure N X * emeasure M (space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>space M \<noteq> {}; X \<in> sets N; subprob_space N\<rbrakk> \<Longrightarrow> emeasure (M \<bind> (\<lambda>x. N)) X = emeasure N X * emeasure M (space M)
[PROOF STEP]
by (simp add: bind_nonempty emeasure_join nn_integral_distr
                space_subprob_algebra measurable_emeasure_subprob_algebra)


[STATEMENT]
lemma inj_on_image_lepoll_1 [simp]:
  assumes "inj_on f A" shows "f ` A \<lesssim> B \<longleftrightarrow> A \<lesssim> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` A \<lesssim> B) = (A \<lesssim> B)
[PROOF STEP]
by (meson assms image_lepoll lepoll_def lepoll_trans order_refl)


[STATEMENT]
lemma Gromov_product_le_dist [simp, mono_intros]:
  "Gromov_product_at e x y \<le> dist e x"
  "Gromov_product_at e x y \<le> dist e y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_product_at e x y \<le> dist e x &&& Gromov_product_at e x y \<le> dist e y
[PROOF STEP]
unfolding Gromov_product_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist e x + dist e y - dist x y) / 2 \<le> dist e x &&& (dist e x + dist e y - dist x y) / 2 \<le> dist e y
[PROOF STEP]
by (auto simp add: diff_le_eq dist_triangle dist_triangle2)


[STATEMENT]
lemma D_base_finite'':
  "finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}
[PROOF STEP]
using D_base_finite[of m i j k]
[PROOF STATE]
proof (prove)
using this:
finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}

goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}
[PROOF STEP]
by - (rule finite_subset, auto)


[STATEMENT]
lemma listDiffMap:
  assumes "\<forall> x y. x \<noteq> y \<longrightarrow> f x \<noteq> f y"
  shows "map f (list_diff a b) = list_diff (map f a) (map f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (list_diff a b) = list_diff (map f a) (map f b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<noteq> y \<longrightarrow> f x \<noteq> f y

goal (1 subgoal):
 1. map f (list_diff a b) = list_diff (map f a) (map f b)
[PROOF STEP]
by (induct b arbitrary: a) (auto simp add: removeAll_map)


[STATEMENT]
lemma strict_mono_natI:
fixes f :: "nat \<Rightarrow> 'a::order"
shows "(\<And>n. f n < f (Suc n)) \<Longrightarrow> strict_mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. f n < f (Suc n)) \<Longrightarrow> OrdinalInduct.strict_mono f
[PROOF STEP]
apply (rule strict_monoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); A < B\<rbrakk> \<Longrightarrow> f A < f B
[PROOF STEP]
apply (drule Suc_leI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); Suc A \<le> B\<rbrakk> \<Longrightarrow> f A < f B
[PROOF STEP]
apply (drule le_add_diff_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); Suc A + (B - Suc A) = B\<rbrakk> \<Longrightarrow> f A < f B
[PROOF STEP]
apply (subgoal_tac "\<forall>k. f A < f (Suc A + k)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); Suc A + (B - Suc A) = B; \<forall>k. f A < f (Suc A + k)\<rbrakk> \<Longrightarrow> f A < f B
 2. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); Suc A + (B - Suc A) = B\<rbrakk> \<Longrightarrow> \<forall>k. f A < f (Suc A + k)
[PROOF STEP]
apply (erule subst, erule spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>n. f n < f (Suc n); Suc A + (B - Suc A) = B\<rbrakk> \<Longrightarrow> \<forall>k. f A < f (Suc A + k)
[PROOF STEP]
apply (rule allI, induct_tac k, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B k n. \<lbrakk>\<And>n. f n < f (Suc n); Suc A + (B - Suc A) = B; f A < f (Suc A + n)\<rbrakk> \<Longrightarrow> f A < f (Suc A + Suc n)
[PROOF STEP]
apply (erule order_less_trans, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Joints_set_zip:
  assumes "ys \<in> Joints YS"
  assumes "length xs = length XS"
  assumes "length YS = length XS"
  assumes sets_eq: "set (zip xs XS) = set (zip ys YS)"
  shows "xs \<in> Joints XS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> Joints XS
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<in> Joints XS
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
ys \<in> Joints YS
length xs = length XS
length YS = length XS
set (zip xs XS) = set (zip ys YS)
[PROOF STEP]
have "length ys = length YS"
[PROOF STATE]
proof (prove)
using this:
ys \<in> Joints YS
length xs = length XS
length YS = length XS
set (zip xs XS) = set (zip ys YS)

goal (1 subgoal):
 1. length ys = length YS
[PROOF STEP]
by (auto simp: Joints_def valuate_def)
[PROOF STATE]
proof (state)
this:
length ys = length YS

goal (1 subgoal):
 1. xs \<in> Joints XS
[PROOF STEP]
from assms(1) this assms(2)
[PROOF STATE]
proof (chain)
picking this:
ys \<in> Joints YS
length ys = length YS
length xs = length XS
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ys \<in> Joints YS
length ys = length YS
length xs = length XS

goal (1 subgoal):
 1. xs \<in> Joints XS
[PROOF STEP]
by (rule Joints_set_zip_subset) (simp add: assms)
[PROOF STATE]
proof (state)
this:
xs \<in> Joints XS

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_add_zero:
  fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_add"
  shows "(f \<longlongrightarrow> 0) F \<Longrightarrow> (g \<longlongrightarrow> 0) F \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> (0::'b)) F; (g \<longlongrightarrow> (0::'b)) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
by (drule (1) tendsto_add) simp


[STATEMENT]
lemma sum_list_nonneg_eq_0_iff:
  "(\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> x) \<Longrightarrow> sum_list xs = 0 \<longleftrightarrow> (\<forall>x\<in> set xs. x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> (0::'a) \<le> x) \<Longrightarrow> (sum_list xs = (0::'a)) = (\<forall>x\<in>set xs. x = (0::'a))
[PROOF STEP]
by (induction xs) (simp_all add: add_nonneg_eq_0_iff sum_list_nonneg)


[STATEMENT]
lemma ord_of_inv:
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "a \<noteq> \<zero>"
  shows "ord (inv\<^bsub>Q\<^sub>p\<^esub> a) = - (ord a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
obtain b c where
   Frac: "a = frac b c" and
   Car: "b \<in> carrier Z\<^sub>p" and
   Nz_c: "c \<in> nonzero Z\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b c. \<lbrakk>a = fraction Z\<^sub>p b c; b \<in> carrier Z\<^sub>p; c \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) local.numer_denom_facts(1) local.numer_denom_facts(2)
          local.numer_denom_facts(5)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
?a \<in> carrier Q\<^sub>p \<Longrightarrow> numerator Z\<^sub>p ?a \<in> carrier Z\<^sub>p
?a \<in> carrier Q\<^sub>p \<Longrightarrow> denominator Z\<^sub>p ?a \<in> nonzero Z\<^sub>p
?a \<in> carrier Q\<^sub>p \<Longrightarrow> ?a = fraction Z\<^sub>p (numerator Z\<^sub>p ?a) (denominator Z\<^sub>p ?a)

goal (1 subgoal):
 1. (\<And>b c. \<lbrakk>a = fraction Z\<^sub>p b c; b \<in> carrier Z\<^sub>p; c \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a = fraction Z\<^sub>p b c
b \<in> carrier Z\<^sub>p
c \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
have Nz_b: "b \<in> nonzero Z\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> nonzero Z\<^sub>p
[PROOF STEP]
using Frac Car Nz_c  assms(2) nonzero_fraction_imp_nonzero_numer
[PROOF STATE]
proof (prove)
using this:
a = fraction Z\<^sub>p b c
b \<in> carrier Z\<^sub>p
c \<in> nonzero Z\<^sub>p
a \<noteq> \<zero>
\<lbrakk>?a \<in> carrier Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p; fraction Z\<^sub>p ?a ?b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ?a \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. b \<in> nonzero Z\<^sub>p
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
b \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> nonzero Z\<^sub>p
[PROOF STEP]
have "(inv\<^bsub>Q\<^sub>p\<^esub> a) = frac c b"
[PROOF STATE]
proof (prove)
using this:
b \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. inv a = fraction Z\<^sub>p c b
[PROOF STEP]
using Frac Nz_c frac_inv Q\<^sub>p_def
[PROOF STATE]
proof (prove)
using this:
b \<in> nonzero Z\<^sub>p
a = fraction Z\<^sub>p b c
c \<in> nonzero Z\<^sub>p
\<lbrakk>?a \<in> nonzero Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> inv\<^bsub>Frac Z\<^sub>p\<^esub> fraction Z\<^sub>p ?a ?b = fraction Z\<^sub>p ?b ?a
Q\<^sub>p \<equiv> Frac Z\<^sub>p

goal (1 subgoal):
 1. inv a = fraction Z\<^sub>p c b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv a = fraction Z\<^sub>p c b

goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv a = fraction Z\<^sub>p c b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inv a = fraction Z\<^sub>p c b

goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
using Frac Nz_b Nz_c ord_of_frac[of b c] ord_of_frac[of c b]
[PROOF STATE]
proof (prove)
using this:
inv a = fraction Z\<^sub>p c b
a = fraction Z\<^sub>p b c
b \<in> nonzero Z\<^sub>p
c \<in> nonzero Z\<^sub>p
\<lbrakk>b \<in> nonzero Z\<^sub>p; c \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> ord (fraction Z\<^sub>p b c) = ord_Zp b - ord_Zp c
\<lbrakk>c \<in> nonzero Z\<^sub>p; b \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> ord (fraction Z\<^sub>p c b) = ord_Zp c - ord_Zp b

goal (1 subgoal):
 1. ord (inv a) = - ord a
[PROOF STEP]
by (simp add: nonzero_def ord_Zp_def)
[PROOF STATE]
proof (state)
this:
ord (inv a) = - ord a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem lfp_if_cont:
  assumes "cont f" shows "lfp f = (UN n. (f^^n) {})" (is "_ = ?U")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = (\<Union>n. (f ^^ n) {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lfp f \<subseteq> (\<Union>n. (f ^^ n) {})
 2. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
from assms mono_if_cont
[PROOF STATE]
proof (chain)
picking this:
cont f
cont ?f \<Longrightarrow> mono ?f
[PROOF STEP]
have mono: "(f ^^ n) {} \<subseteq> (f ^^ Suc n) {}" for n
[PROOF STATE]
proof (prove)
using this:
cont f
cont ?f \<Longrightarrow> mono ?f

goal (1 subgoal):
 1. (f ^^ n) {} \<subseteq> (f ^^ Suc n) {}
[PROOF STEP]
using funpow_decreasing [of n "Suc n"]
[PROOF STATE]
proof (prove)
using this:
cont f
cont ?f \<Longrightarrow> mono ?f
\<lbrakk>n \<le> Suc n; mono ?f\<rbrakk> \<Longrightarrow> (?f ^^ n) bot \<le> (?f ^^ Suc n) bot

goal (1 subgoal):
 1. (f ^^ n) {} \<subseteq> (f ^^ Suc n) {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f ^^ ?n) {} \<subseteq> (f ^^ Suc ?n) {}

goal (2 subgoals):
 1. lfp f \<subseteq> (\<Union>n. (f ^^ n) {})
 2. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
show "lfp f \<subseteq> ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
proof (rule lfp_lowerbound)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
have "f ?U = (UN n. (f^^Suc n){})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ Suc n) {})
[PROOF STEP]
using chain_iterates[OF mono_if_cont[OF assms]] assms
[PROOF STATE]
proof (prove)
using this:
chain (\<lambda>n. (f ^^ n) {})
cont f

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ Suc n) {})
[PROOF STEP]
by(simp add: cont_def)
[PROOF STATE]
proof (state)
this:
f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ Suc n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ Suc n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
have "\<dots> = (f^^0){} \<union> \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n. (f ^^ Suc n) {}) = (f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>n. (f ^^ Suc n) {}) = (f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>n. (f ^^ Suc n) {}) = (f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
have "\<dots> = ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {}) = (\<Union>n. (f ^^ n) {})
[PROOF STEP]
using mono
[PROOF STATE]
proof (prove)
using this:
(f ^^ ?n) {} \<subseteq> (f ^^ Suc ?n) {}

goal (1 subgoal):
 1. (f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {}) = (\<Union>n. (f ^^ n) {})
[PROOF STEP]
by auto (metis funpow_simps_right(2) funpow_swap1 o_apply)
[PROOF STATE]
proof (state)
this:
(f ^^ 0) {} \<union> (\<Union>n. (f ^^ Suc n) {}) = (\<Union>n. (f ^^ n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ n) {})
[PROOF STEP]
show "f ?U \<subseteq> ?U"
[PROOF STATE]
proof (prove)
using this:
f (\<Union>n. (f ^^ n) {}) = (\<Union>n. (f ^^ n) {})

goal (1 subgoal):
 1. f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (\<Union>n. (f ^^ n) {}) \<subseteq> (\<Union>n. (f ^^ n) {})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lfp f \<subseteq> (\<Union>n. (f ^^ n) {})

goal (1 subgoal):
 1. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
have "(f^^n){} \<subseteq> p" if "f p \<subseteq> p" for n p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ n) {} \<subseteq> p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f ^^ n) {} \<subseteq> p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ n) {} \<subseteq> p
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (f ^^ 0) {} \<subseteq> p
 2. \<And>n. (f ^^ n) {} \<subseteq> p \<Longrightarrow> (f ^^ Suc n) {} \<subseteq> p
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (f ^^ 0) {} \<subseteq> p
 2. \<And>n. (f ^^ n) {} \<subseteq> p \<Longrightarrow> (f ^^ Suc n) {} \<subseteq> p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ 0) {} \<subseteq> p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f ^^ 0) {} \<subseteq> p

goal (1 subgoal):
 1. \<And>n. (f ^^ n) {} \<subseteq> p \<Longrightarrow> (f ^^ Suc n) {} \<subseteq> p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (f ^^ n) {} \<subseteq> p \<Longrightarrow> (f ^^ Suc n) {} \<subseteq> p
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
(f ^^ n_) {} \<subseteq> p

goal (1 subgoal):
 1. \<And>n. (f ^^ n) {} \<subseteq> p \<Longrightarrow> (f ^^ Suc n) {} \<subseteq> p
[PROOF STEP]
from monoD[OF mono_if_cont[OF assms] Suc] \<open>f p \<subseteq> p\<close>
[PROOF STATE]
proof (chain)
picking this:
f ((f ^^ n_) {}) \<subseteq> f p
f p \<subseteq> p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
f ((f ^^ n_) {}) \<subseteq> f p
f p \<subseteq> p

goal (1 subgoal):
 1. (f ^^ Suc n_) {} \<subseteq> p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f ^^ Suc n_) {} \<subseteq> p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f ^^ n) {} \<subseteq> p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ?p \<subseteq> ?p \<Longrightarrow> (f ^^ ?n) {} \<subseteq> ?p

goal (1 subgoal):
 1. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
thus "?U \<subseteq> lfp f"
[PROOF STATE]
proof (prove)
using this:
f ?p \<subseteq> ?p \<Longrightarrow> (f ^^ ?n) {} \<subseteq> ?p

goal (1 subgoal):
 1. (\<Union>n. (f ^^ n) {}) \<subseteq> lfp f
[PROOF STEP]
by(auto simp: lfp_def)
[PROOF STATE]
proof (state)
this:
(\<Union>n. (f ^^ n) {}) \<subseteq> lfp f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_div_of_complex [simp]:
  assumes "x \<noteq> 0"
  shows "1\<^sub>h :\<^sub>h of_complex x = of_complex (1 / x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>h :\<^sub>h of_complex x = of_complex (1 / x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. 1\<^sub>h :\<^sub>h of_complex x = of_complex (1 / x)
[PROOF STEP]
unfolding divide_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. 1\<^sub>h *\<^sub>h reciprocal (of_complex x) = of_complex (1 / x)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in is_functor) cf_of_cf_map_is_functor':
  assumes "\<FF>' = cf_map \<FF>"
    and "\<AA>' = \<AA>"
    and "\<BB>' = \<BB>"
  shows "cf_of_cf_map \<AA> \<BB> \<FF>' : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_of_cf_map \<AA> \<BB> \<FF>' : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_of_cf_map \<AA> \<BB> (cf_map \<FF>) : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule cf_of_cf_map_is_functor)


[STATEMENT]
lemma conjugate_smult_vec:
  fixes k :: "'a :: conjugatable_ring"
  shows "conjugate (k \<cdot>\<^sub>v v) = conjugate k \<cdot>\<^sub>v conjugate v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (k \<cdot>\<^sub>v v) = conjugate k \<cdot>\<^sub>v conjugate v
[PROOF STEP]
using conjugate_dist_mul
[PROOF STATE]
proof (prove)
using this:
conjugate (?a * ?b) = conjugate ?a * conjugate ?b

goal (1 subgoal):
 1. conjugate (k \<cdot>\<^sub>v v) = conjugate k \<cdot>\<^sub>v conjugate v
[PROOF STEP]
by (intro eq_vecI, auto)


[STATEMENT]
lemma suminf_exist_split:
  fixes r :: real
  assumes "0 < r" and "summable f"
  shows "\<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r
[PROOF STEP]
from LIMSEQ_D[OF summable_LIMSEQ[OF \<open>summable f\<close>] \<open>0 < r\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<exists>no. \<forall>n\<ge>no. norm (sum f {..<n} - suminf f) < r
[PROOF STEP]
obtain N :: nat where "\<forall> n \<ge> N. norm (sum f {..<n} - suminf f) < r"
[PROOF STATE]
proof (prove)
using this:
\<exists>no. \<forall>n\<ge>no. norm (sum f {..<n} - suminf f) < r

goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. norm (sum f {..<n} - suminf f) < r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. norm (sum f {..<n} - suminf f) < r

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>N. norm (sum f {..<n} - suminf f) < r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. norm (sum f {..<n} - suminf f) < r

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r
[PROOF STEP]
by (auto simp: norm_minus_commute suminf_minus_initial_segment[OF \<open>summable f\<close>])
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r

goal:
No subgoals!
[PROOF STEP]
qed