[STATEMENT]
lemma powsum2: "x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m \<^esup>+ x\<^bsup>n+Suc m\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
have "x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..(Suc m)+n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..Suc m + n}
[PROOF STEP]
using powsum_def
[PROOF STATE]
proof (prove)
using this:
?x\<^bsub>?m\<^esub>\<^bsup>?n\<^esup> = sum ((^) ?x) {?m..?n + ?m}

goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..Suc m + n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..Suc m + n}

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

goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
have "... = sum ((^) x) {n..m+n} +  x\<^bsup>n+Suc m\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) x) {n..Suc m + n} = sum ((^) x) {n..m + n} + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
by (simp add: ab_semigroup_add_class.add.commute atLeastAtMostSuc_conv local.join.sup_commute)
[PROOF STATE]
proof (state)
this:
sum ((^) x) {n..Suc m + n} = sum ((^) x) {n..m + n} + x\<^bsup>n + Suc m\<^esup>

goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..m + n} + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = sum ((^) x) {n..m + n} + x\<^bsup>n + Suc m\<^esup>

goal (1 subgoal):
 1. x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>
[PROOF STEP]
by (simp add: powsum_def)
[PROOF STATE]
proof (state)
this:
x\<^bsub>n\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>n\<^esub>\<^bsup>m\<^esup> + x\<^bsup>n + Suc m\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid_mult) foldl_absorb1: "x*foldl (*) 1 zs = foldl (*) x zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * foldl (*) (1::'a) zs = foldl (*) x zs
[PROOF STEP]
apply (rule sym)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (*) x zs = x * foldl (*) (1::'a) zs
[PROOF STEP]
apply (rule foldl_A1_eq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>e. (1::'a) * e = e
 2. \<And>e. e * (1::'a) = e
 3. \<And>a b c. a * (b * c) = a * b * c
[PROOF STEP]
apply (auto simp add: mult.assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lits_subseteq_imp_atms_subseteq: "set_mset C \<subseteq> set_mset D \<Longrightarrow> atms_of C \<subseteq> atms_of D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset C \<subseteq> set_mset D \<Longrightarrow> atms_of C \<subseteq> atms_of D
[PROOF STEP]
unfolding atms_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset C \<subseteq> set_mset D \<Longrightarrow> atm_of ` set_mset C \<subseteq> atm_of ` set_mset D
[PROOF STEP]
by blast


[STATEMENT]
theorem rquicksort_correct:
  assumes "trans R" and "total_on (set xs) R" and "\<forall>x\<in>set xs. (x,x) \<in> R"
  assumes "(ys, n) \<in> set_pmf (rquicksort R xs)"
  shows   "sorted_wrt R ys \<and> mset ys = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
using assms(2-)
[PROOF STATE]
proof (prove)
using this:
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
proof (induction xs arbitrary: ys n rule: length_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys n. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> total_on (set ys) R \<longrightarrow> (\<forall>x\<in>set ys. (x, x) \<in> R) \<longrightarrow> (\<forall>x xa. (x, xa) \<in> set_pmf (rquicksort R ys) \<longrightarrow> Linorder_Relations.sorted_wrt R x \<and> mset x = mset ys); total_on (set xs) R; \<forall>x\<in>set xs. (x, x) \<in> R; (ys, n) \<in> set_pmf (rquicksort R xs)\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
case (1 xs)
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length xs \<longrightarrow> total_on (set ys) R \<longrightarrow> (\<forall>x\<in>set ys. (x, x) \<in> R) \<longrightarrow> (\<forall>x xa. (x, xa) \<in> set_pmf (rquicksort R ys) \<longrightarrow> Linorder_Relations.sorted_wrt R x \<and> mset x = mset ys)
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)

goal (1 subgoal):
 1. \<And>xs ys n. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> total_on (set ys) R \<longrightarrow> (\<forall>x\<in>set ys. (x, x) \<in> R) \<longrightarrow> (\<forall>x xa. (x, xa) \<in> set_pmf (rquicksort R ys) \<longrightarrow> Linorder_Relations.sorted_wrt R x \<and> mset x = mset ys); total_on (set xs) R; \<forall>x\<in>set xs. (x, x) \<in> R; (ys, n) \<in> set_pmf (rquicksort R xs)\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have IH: "sorted_wrt R zs" "mset zs = mset ys"
    if "(zs, n) \<in> set_pmf (rquicksort R ys)" "length ys < length xs" "set ys \<subseteq> set xs" for zs ys n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R zs &&& mset zs = mset ys
[PROOF STEP]
using that "1.IH" total_on_subset[OF "1.prems"(1) that(3)] "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
(zs, n) \<in> set_pmf (rquicksort R ys)
length ys < length xs
set ys \<subseteq> set xs
\<forall>ys. length ys < length xs \<longrightarrow> total_on (set ys) R \<longrightarrow> (\<forall>x\<in>set ys. (x, x) \<in> R) \<longrightarrow> (\<forall>x xa. (x, xa) \<in> set_pmf (rquicksort R ys) \<longrightarrow> Linorder_Relations.sorted_wrt R x \<and> mset x = mset ys)
total_on (set ys) R
\<forall>x\<in>set xs. (x, x) \<in> R

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R zs &&& mset zs = mset ys
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?zs, ?n) \<in> set_pmf (rquicksort R ?ys); length ?ys < length xs; set ?ys \<subseteq> set xs\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R ?zs
\<lbrakk>(?zs, ?n) \<in> set_pmf (rquicksort R ?ys); length ?ys < length xs; set ?ys \<subseteq> set xs\<rbrakk> \<Longrightarrow> mset ?zs = mset ?ys

goal (1 subgoal):
 1. \<And>xs ys n. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> total_on (set ys) R \<longrightarrow> (\<forall>x\<in>set ys. (x, x) \<in> R) \<longrightarrow> (\<forall>x xa. (x, xa) \<in> set_pmf (rquicksort R ys) \<longrightarrow> Linorder_Relations.sorted_wrt R x \<and> mset x = mset ys); total_on (set xs) R; \<forall>x\<in>set xs. (x, x) \<in> R; (ys, n) \<in> set_pmf (rquicksort R xs)\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
proof (cases "xs = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
with "1.prems"
[PROOF STATE]
proof (chain)
picking this:
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)
xs \<noteq> []
[PROOF STEP]
obtain ls rs n1 n2 i where *:
       "i < length xs" "(ls, n1) \<in> set_pmf (rquicksort R [y\<leftarrow>delete_index i xs. (y, xs ! i) \<in> R])"
       "(rs, n2) \<in> set_pmf (rquicksort R [y\<leftarrow>delete_index i xs. (y, xs ! i) \<notin> R])"
       "ys = ls @ [xs ! i] @ rs"
[PROOF STATE]
proof (prove)
using this:
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)
xs \<noteq> []

goal (1 subgoal):
 1. (\<And>i ls n1 rs n2. \<lbrakk>i < length xs; (ls, n1) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs))); (rs, n2) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs))); ys = ls @ [xs ! i] @ rs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) rquicksort.simps[of _ xs]) (auto simp: Let_def o_def)
[PROOF STATE]
proof (state)
this:
i < length xs
(ls, n1) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs)))
(rs, n2) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)))
ys = ls @ [xs ! i] @ rs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
note ys = \<open>ys = ls @ [xs ! i] @ rs\<close>
[PROOF STATE]
proof (state)
this:
ys = ls @ [xs ! i] @ rs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
define ls' where "ls' = [y\<leftarrow>delete_index i xs. (y, xs ! i) \<in> R]"
[PROOF STATE]
proof (state)
this:
ls' = filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
define rs' where "rs' = [y\<leftarrow>delete_index i xs. (y, xs ! i) \<notin> R]"
[PROOF STATE]
proof (state)
this:
rs' = filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
from \<open>i < length xs\<close>
[PROOF STATE]
proof (chain)
picking this:
i < length xs
[PROOF STEP]
have less: "length ls' < length xs" "length rs' < length xs"
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. length ls' < length xs &&& length rs' < length xs
[PROOF STEP]
unfolding ls'_def rs'_def
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. length (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs)) < length xs &&& length (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)) < length xs
[PROOF STEP]
by (intro le_less_trans[OF length_filter_le]; force)+
[PROOF STATE]
proof (state)
this:
length ls' < length xs
length rs' < length xs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have ls: "(ls, n1) \<in> set_pmf (rquicksort R ls')" and rs: "(rs, n2) \<in> set_pmf (rquicksort R rs')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ls, n1) \<in> set_pmf (rquicksort R ls') &&& (rs, n2) \<in> set_pmf (rquicksort R rs')
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
i < length xs
(ls, n1) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs)))
(rs, n2) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)))
ys = ls @ [xs ! i] @ rs

goal (1 subgoal):
 1. (ls, n1) \<in> set_pmf (rquicksort R ls') &&& (rs, n2) \<in> set_pmf (rquicksort R rs')
[PROOF STEP]
unfolding ls'_def rs'_def
[PROOF STATE]
proof (prove)
using this:
i < length xs
(ls, n1) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs)))
(rs, n2) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)))
ys = ls @ [xs ! i] @ rs

goal (1 subgoal):
 1. (ls, n1) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<in> R) (delete_index i xs))) &&& (rs, n2) \<in> set_pmf (rquicksort R (filter (\<lambda>y. (y, xs ! i) \<notin> R) (delete_index i xs)))
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
(ls, n1) \<in> set_pmf (rquicksort R ls')
(rs, n2) \<in> set_pmf (rquicksort R rs')

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have subset: "set ls' \<subseteq> set xs" "set rs' \<subseteq> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ls' \<subseteq> set xs &&& set rs' \<subseteq> set xs
[PROOF STEP]
using insert_set_delete_index[of i xs] \<open>i < length xs\<close>
[PROOF STATE]
proof (prove)
using this:
i < length xs \<Longrightarrow> insert (xs ! i) (set (delete_index i xs)) = set xs
i < length xs

goal (1 subgoal):
 1. set ls' \<subseteq> set xs &&& set rs' \<subseteq> set xs
[PROOF STEP]
by (auto simp: ls'_def rs'_def)
[PROOF STATE]
proof (state)
this:
set ls' \<subseteq> set xs
set rs' \<subseteq> set xs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have sorted: "sorted_wrt R ls" "sorted_wrt R rs"
     and mset: "mset ls = mset ls'" "mset rs = mset rs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Linorder_Relations.sorted_wrt R ls &&& Linorder_Relations.sorted_wrt R rs) &&& mset ls = mset ls' &&& mset rs = mset rs'
[PROOF STEP]
by (rule IH[of ls n1 ls'] IH[of rs n2 rs'] less ls rs subset)+
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R ls
Linorder_Relations.sorted_wrt R rs
mset ls = mset ls'
mset rs = mset rs'

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have ls_le: "(x, xs ! i) \<in> R" if "x \<in> set ls" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
x \<in> set ls
[PROOF STEP]
have "x \<in># mset ls"
[PROOF STATE]
proof (prove)
using this:
x \<in> set ls

goal (1 subgoal):
 1. x \<in># mset ls
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in># mset ls

goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<in># mset ls

goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
note mset(1)
[PROOF STATE]
proof (state)
this:
mset ls = mset ls'

goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<in># mset ls'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in># mset ls'

goal (1 subgoal):
 1. (x, xs ! i) \<in> R
[PROOF STEP]
by (simp add: ls'_def)
[PROOF STATE]
proof (state)
this:
(x, xs ! i) \<in> R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> set ls \<Longrightarrow> (?x, xs ! i) \<in> R

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have rs_ge: "(x, xs ! i) \<notin> R" "(xs ! i, x) \<in> R" if "x \<in> set rs" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, xs ! i) \<notin> R &&& (xs ! i, x) \<in> R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x, xs ! i) \<notin> R
 2. (xs ! i, x) \<in> R
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
x \<in> set rs
[PROOF STEP]
have "x \<in># mset rs"
[PROOF STATE]
proof (prove)
using this:
x \<in> set rs

goal (1 subgoal):
 1. x \<in># mset rs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in># mset rs

goal (2 subgoals):
 1. (x, xs ! i) \<notin> R
 2. (xs ! i, x) \<in> R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<in># mset rs

goal (2 subgoals):
 1. (x, xs ! i) \<notin> R
 2. (xs ! i, x) \<in> R
[PROOF STEP]
note mset(2)
[PROOF STATE]
proof (state)
this:
mset rs = mset rs'

goal (2 subgoals):
 1. (x, xs ! i) \<notin> R
 2. (xs ! i, x) \<in> R
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<in># mset rs'
[PROOF STEP]
have x: "x \<in> set rs'"
[PROOF STATE]
proof (prove)
using this:
x \<in># mset rs'

goal (1 subgoal):
 1. x \<in> set rs'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> set rs'

goal (2 subgoals):
 1. (x, xs ! i) \<notin> R
 2. (xs ! i, x) \<in> R
[PROOF STEP]
thus "(x, xs ! i) \<notin> R"
[PROOF STATE]
proof (prove)
using this:
x \<in> set rs'

goal (1 subgoal):
 1. (x, xs ! i) \<notin> R
[PROOF STEP]
by (simp_all add: rs'_def)
[PROOF STATE]
proof (state)
this:
(x, xs ! i) \<notin> R

goal (1 subgoal):
 1. (xs ! i, x) \<in> R
[PROOF STEP]
from x and subset and \<open>i < length xs\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> set rs'
set ls' \<subseteq> set xs
set rs' \<subseteq> set xs
i < length xs
[PROOF STEP]
have "x \<in> set xs" "xs ! i \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> set rs'
set ls' \<subseteq> set xs
set rs' \<subseteq> set xs
i < length xs

goal (1 subgoal):
 1. x \<in> set xs &&& xs ! i \<in> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set xs
xs ! i \<in> set xs

goal (1 subgoal):
 1. (xs ! i, x) \<in> R
[PROOF STEP]
with "1.prems" and \<open>(x, xs ! i) \<notin> R\<close>
[PROOF STATE]
proof (chain)
picking this:
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)
(x, xs ! i) \<notin> R
x \<in> set xs
xs ! i \<in> set xs
[PROOF STEP]
show "(xs ! i, x) \<in> R"
[PROOF STATE]
proof (prove)
using this:
total_on (set xs) R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)
(x, xs ! i) \<notin> R
x \<in> set xs
xs ! i \<in> set xs

goal (1 subgoal):
 1. (xs ! i, x) \<in> R
[PROOF STEP]
unfolding total_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. \<forall>y\<in>set xs. x \<noteq> y \<longrightarrow> (x, y) \<in> R \<or> (y, x) \<in> R
\<forall>x\<in>set xs. (x, x) \<in> R
(ys, n) \<in> set_pmf (rquicksort R xs)
(x, xs ! i) \<notin> R
x \<in> set xs
xs ! i \<in> set xs

goal (1 subgoal):
 1. (xs ! i, x) \<in> R
[PROOF STEP]
by (cases "xs ! i = x") auto
[PROOF STATE]
proof (state)
this:
(xs ! i, x) \<in> R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> set rs \<Longrightarrow> (?x, xs ! i) \<notin> R
?x \<in> set rs \<Longrightarrow> (xs ! i, ?x) \<in> R

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have "sorted_wrt R ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R ys
[PROOF STEP]
unfolding ys
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (ls @ [xs ! i] @ rs)
[PROOF STEP]
by (intro sorted_wrt_append \<open>trans R\<close> sorted_wrt_singleton sorted)
         (auto intro: rs_ge ls_le transD[OF \<open>trans R\<close>, of _ "xs!i"])
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R ys

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R ys

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
have "mset ys = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ys = mset xs
[PROOF STEP]
unfolding ys
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (ls @ [xs ! i] @ rs) = mset xs
[PROOF STEP]
using \<open>i < length xs\<close>
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. mset (ls @ [xs ! i] @ rs) = mset xs
[PROOF STEP]
by (simp add: mset ls'_def rs'_def add_mset_delete_index)
[PROOF STATE]
proof (state)
this:
mset ys = mset xs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
 2. xs \<noteq> [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Linorder_Relations.sorted_wrt R ys
mset ys = mset xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Linorder_Relations.sorted_wrt R ys
mset ys = mset xs

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs

goal (1 subgoal):
 1. xs = [] \<Longrightarrow> Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs
[PROOF STEP]
qed (insert "1.prems", simp_all)
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R ys \<and> mset ys = mset xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem SC_counterexample:
  "(C,D) \<in> sc \<Gamma> A \<Delta> B \<Longrightarrow>
  (\<lambda>a. a \<in> set C) \<not>\<Turnstile> image_mset Atom (mset A) + mset \<Gamma> \<Rightarrow> image_mset Atom (mset B) + mset \<Delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C, D) \<in> sc \<Gamma> A \<Delta> B \<Longrightarrow> (\<lambda>a. a \<in> set C) \<not>\<Turnstile> image_mset Atom (mset A) + mset \<Gamma> \<Rightarrow> image_mset Atom (mset B) + mset \<Delta>
[PROOF STEP]
by(induction rule: sc.induct[where 'a='a];
   simp add: sequent_semantics_def split: if_splits;
   (* used to be only for one, now it's four\<dots> *) blast)


[STATEMENT]
lemma (in prob_space) diff_indep_normal:
  assumes indep[simp]: "indep_var borel X borel Y"
  assumes [simp, arith]: "0 < \<sigma>" "0 < \<tau>"
  assumes normalX[simp]: "distributed M lborel X (normal_density \<mu> \<sigma>)"
  assumes normalY[simp]: "distributed M lborel Y (normal_density \<nu> \<tau>)"
  shows "distributed M lborel (\<lambda>x. X x - Y x) (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. 0 + - 1 * Y x) (\<lambda>x. ennreal (normal_density (0 + - 1 * \<nu>) (\<bar>- 1\<bar> * \<tau>) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. 0 + - 1 * Y x) (\<lambda>x. ennreal (normal_density (0 + - 1 * \<nu>) (\<bar>- 1\<bar> * \<tau>) x))
[PROOF STEP]
by(rule normal_density_affine, auto)
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. 0 + - 1 * Y x) (\<lambda>x. ennreal (normal_density (0 + - 1 * \<nu>) (\<bar>- 1\<bar> * \<tau>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. 0 + - 1 * Y x) (\<lambda>x. ennreal (normal_density (0 + - 1 * \<nu>) (\<bar>- 1\<bar> * \<tau>) x))
[PROOF STEP]
have [simp]:"distributed M lborel (\<lambda>x. - Y x) (\<lambda>x. ennreal (normal_density (- \<nu>) \<tau> x))"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. 0 + - 1 * Y x) (\<lambda>x. ennreal (normal_density (0 + - 1 * \<nu>) (\<bar>- 1\<bar> * \<tau>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - Y x) (\<lambda>x. ennreal (normal_density (- \<nu>) \<tau> x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - Y x) (\<lambda>x. ennreal (normal_density (- \<nu>) \<tau> x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. X x + (- Y x)) (normal_density (\<mu> + - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + - Y x) (\<lambda>x. ennreal (normal_density (\<mu> + - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
apply (rule add_indep_normal)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. indep_var borel X borel (\<lambda>x. - Y x)
 2. 0 < \<sigma>
 3. 0 < \<tau>
 4. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
 5. distributed M lborel (\<lambda>x. - Y x) (\<lambda>x. ennreal (normal_density (- \<nu>) \<tau> x))
[PROOF STEP]
apply (rule indep_var_compose[unfolded comp_def, of borel _ borel _ "\<lambda>x. x" _ "\<lambda>x. - x"])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. indep_var borel X borel Y
 2. (\<lambda>x. x) \<in> borel_measurable borel
 3. uminus \<in> borel_measurable borel
 4. 0 < \<sigma>
 5. 0 < \<tau>
 6. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
 7. distributed M lborel (\<lambda>x. - Y x) (\<lambda>x. ennreal (normal_density (- \<nu>) \<tau> x))
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. X x + - Y x) (\<lambda>x. ennreal (normal_density (\<mu> + - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. X x + - Y x) (\<lambda>x. ennreal (normal_density (\<mu> + - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. X x + - Y x) (\<lambda>x. ennreal (normal_density (\<mu> + - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. X x - Y x) (\<lambda>x. ennreal (normal_density (\<mu> - \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_of_Ord: "Ord i \<Longrightarrow> rank i = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord i \<Longrightarrow> rank i = i
[PROOF STEP]
by (induction rule: Ord_induct) (metis (no_types, lifting) Ord_equality SUP_cong rank_Sup)


[STATEMENT]
lemma insertion_power: "insertion f (p ^ n) = insertion f p ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (p ^ n) = insertion f p ^ n
[PROOF STEP]
by (induction n) (simp_all add: insertion_mult)


[STATEMENT]
lemma DERIV_subset:
  "(f has_field_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow>
    (f has_field_derivative f') (at x within t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative f') (at x within s); t \<subseteq> s\<rbrakk> \<Longrightarrow> (f has_field_derivative f') (at x within t)
[PROOF STEP]
by (simp add: has_field_derivative_def has_derivative_subset)


[STATEMENT]
lemma minusset_is_empty_iff [simp]: "minusset A = {} \<longleftrightarrow> A \<inter> G = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (minusset A = {}) = (A \<inter> G = {})
[PROOF STEP]
by (auto simp: minusset_eq)


[STATEMENT]
lemma omega_leI: "\<forall>n. ordinal_of_nat n \<le> x \<Longrightarrow> \<omega> \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. ordinal_of_nat n \<le> x \<Longrightarrow> \<omega> \<le> x
[PROOF STEP]
by (unfold omega_def, erule oLimit_leI)


[STATEMENT]
lemma lformula_disjuncts: "(\<forall>\<psi> \<in> disjuncts \<phi>. lformula \<psi>) = lformula \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (disjuncts \<phi>) lformula = lformula \<phi>
[PROOF STEP]
by (induct \<phi> rule: disjuncts.induct) fastforce+


[STATEMENT]
lemma HComplex_mult_hcomplex_of_hypreal:
  "\<And>x y r. HComplex x y * hcomplex_of_hypreal r = HComplex (x * r) (y * r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y r. HComplex x y * hcomplex_of_hypreal r = HComplex (x * r) (y * r)
[PROOF STEP]
by transfer (rule Complex_mult_complex_of_real)


[STATEMENT]
lemma inorder_join:
  "inorder(join l r) = inorder l @ inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inorder (join l r) = inorder l @ inorder r
[PROOF STEP]
by(induction l r rule: join.induct) (auto split: tree.split)


[STATEMENT]
lemma invars_pop_big: "\<lbrakk>
  invar (States dir big small);
  0 < size big;
  Big.pop big = (x, big')\<rbrakk>
 \<Longrightarrow> invar big' \<and> invar small"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, big')\<rbrakk> \<Longrightarrow> invar big' \<and> invar small
[PROOF STEP]
by(auto simp: Big_Proof.invar_pop)


[STATEMENT]
lemma calc_ideal_point_1_unit:
  assumes "is_real A" "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
  assumes "(z1, z2) = calc_ideal_point1_cvec A B"
  shows "z1 * cnj z1 = z2 * cnj z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
let ?discr = "Re ((cmod B)\<^sup>2 - (Re A)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "?discr > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point1_cvec A B

goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
by (simp add: cmod_power2)
[PROOF STATE]
proof (state)
this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "(B*(-A - \<i>*sqrt(?discr))) * cnj (B*(-A - \<i>*sqrt(?discr))) = (B * cnj B) * (A\<^sup>2 + cor (abs ?discr))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)
[PROOF STEP]
using \<open>is_real A\<close> eq_cnj_iff_real[of A]
[PROOF STATE]
proof (prove)
using this:
is_real A
(cnj A = A) = is_real A

goal (1 subgoal):
 1. B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "... = (B * cnj B) * (cmod B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using \<open>?discr > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point1_cvec A B

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using complex_of_real_Re[of "(cmod B)\<^sup>2 - (Re A)\<^sup>2"] complex_of_real_Re[of A] \<open>is_real A\<close>
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point1_cvec A B
is_real (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)) \<Longrightarrow> cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))) = cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)
is_real A \<Longrightarrow> cor (Re A) = A
is_real A

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "... = (cmod B)\<^sup>2 * cnj ((cmod B)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
using complex_cnj_complex_of_real complex_mult_cnj_cmod
[PROOF STATE]
proof (prove)
using this:
cnj (cor ?x) = cor ?x
?z * cnj ?z = cor ((cmod ?z)\<^sup>2)

goal (1 subgoal):
 1. B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point1_cvec A B

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = z2 * cnj z2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma empty_interior_lowdim_gen_le:
  fixes S :: "'N::euclidean_space set" and T :: "'M::euclidean_space set"
  assumes "DIM('M) \<le> DIM('N)"  "interior T = {}" "S homeomorphic T"
  shows "interior S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
by (metis assms empty_interior_lowdim_gen homeomorphic_empty(1) homeomorphic_interiors_same_dimension less_le)


[STATEMENT]
lemma and_not_num_eq_None_iff:
  \<open>and_not_num m n = None \<longleftrightarrow> numeral m AND NOT (numeral n) = (0 :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (and_not_num m n = None) = (numeral m AND NOT (numeral n) = 0)
[PROOF STEP]
by (simp del: not_numeral_eq add: int_numeral_and_not_num split: option.split)


[STATEMENT]
lemma cf_lcomp_ObjMap_vdomain[cat_cs_simps]:
  assumes "category \<alpha> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<D>\<^sub>\<circ> (cf_lcomp \<CC> \<SS> \<FF>\<lparr>ObjMap\<rparr>) = (\<AA> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_lcomp \<CC> \<SS> \<FF>\<lparr>ObjMap\<rparr>) = (\<AA> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_lcomp \<CC> \<SS> \<FF>\<lparr>ObjMap\<rparr>) = (\<AA> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cf_lcomp_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_bcomp \<SS> \<FF> (dghm_id \<CC>)\<lparr>ObjMap\<rparr>) = (\<AA> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros)


[STATEMENT]
lemma odd_block_size_mod_2:
  assumes "CARD('b::prime_card) = 2"
  assumes "j < \<b>"
  shows "of_nat (card (\<B>s ! j)) = (1 :: 'b mod_ring)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (card (\<B>s ! j)) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat (card (\<B>s ! j)) = 1
[PROOF STEP]
have cb2: "CARD('b) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
CARD('b) = 2
j < \<b>

goal (1 subgoal):
 1. CARD('b) = 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
CARD('b) = 2

goal (1 subgoal):
 1. of_nat (card (\<B>s ! j)) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
CARD('b) = 2
[PROOF STEP]
have "odd (card (\<B>s ! j))"
[PROOF STATE]
proof (prove)
using this:
CARD('b) = 2

goal (1 subgoal):
 1. odd (card (\<B>s ! j))
[PROOF STEP]
using \<open>j < \<b>\<close> odd_groups
[PROOF STATE]
proof (prove)
using this:
CARD('b) = 2
j < \<b>
?bl \<in># \<B> \<Longrightarrow> odd (card ?bl)

goal (1 subgoal):
 1. odd (card (\<B>s ! j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
odd (card (\<B>s ! j))

goal (1 subgoal):
 1. of_nat (card (\<B>s ! j)) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd (card (\<B>s ! j))
[PROOF STEP]
show "of_nat (card (\<B>s ! j)) = (1 :: 'b mod_ring)"
[PROOF STATE]
proof (prove)
using this:
odd (card (\<B>s ! j))

goal (1 subgoal):
 1. of_nat (card (\<B>s ! j)) = 1
[PROOF STEP]
by(transfer' fixing: j \<B>s, simp add: cb2) presburger
[PROOF STATE]
proof (state)
this:
of_nat (card (\<B>s ! j)) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_opt_trans [rule_format]:
  "order r \<Longrightarrow> x \<sqsubseteq>\<^bsub>le r\<^esub> y \<longrightarrow> y \<sqsubseteq>\<^bsub>le r\<^esub> z \<longrightarrow> x \<sqsubseteq>\<^bsub>le r\<^esub> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> x \<sqsubseteq>\<^bsub>Opt.le r\<^esub> y \<longrightarrow> y \<sqsubseteq>\<^bsub>Opt.le r\<^esub> z \<longrightarrow> x \<sqsubseteq>\<^bsub>Opt.le r\<^esub> z
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> x \<sqsubseteq>\<^bsub>Opt.le r\<^esub> y \<longrightarrow> y \<sqsubseteq>\<^bsub>Opt.le r\<^esub> z \<longrightarrow> x \<sqsubseteq>\<^bsub>Opt.le r\<^esub> z
[PROOF STEP]
apply (simp add: unfold_le_opt split: option.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> \<forall>x2 x2a. x = Some x2a \<longrightarrow> z = Some x2 \<longrightarrow> (\<forall>x2b. y = Some x2b \<longrightarrow> x2a \<sqsubseteq>\<^bsub>r\<^esub> x2b \<longrightarrow> x2b \<sqsubseteq>\<^bsub>r\<^esub> x2 \<longrightarrow> x2a \<sqsubseteq>\<^bsub>r\<^esub> x2)
[PROOF STEP]
apply (blast intro: order_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma disj_matrices_add_x_le: "disj_matrices A B \<Longrightarrow> disj_matrices B C \<Longrightarrow>
  (A <= B + C) = (A <= C & 0 <= (B::('a::lattice_ab_group_add) matrix))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>disj_matrices A B; disj_matrices B C\<rbrakk> \<Longrightarrow> (A \<le> B + C) = (A \<le> C \<and> 0 \<le> B)
[PROOF STEP]
by (auto simp add: disj_matrices_add[of 0 A B C, simplified])


[STATEMENT]
lemma iMin_mono_on2: "
  \<lbrakk> mono_on f I; I \<noteq> {} \<rbrakk> \<Longrightarrow> iMin (f ` I) = f (iMin I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>SetInterval2.mono_on f I; I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin (f ` I) = f (iMin I)
[PROOF STEP]
by (rule iMin_mono_on, blast+)


[STATEMENT]
lemma tendsto_real_root [tendsto_intros]:
  "(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. root n (f x)) \<longlongrightarrow> root n x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. root n (f x)) \<longlongrightarrow> root n x) F
[PROOF STEP]
using isCont_tendsto_compose[OF isCont_real_root, of f x F]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. root ?n1 (f x)) \<longlongrightarrow> root ?n1 x) F

goal (1 subgoal):
 1. (f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. root n (f x)) \<longlongrightarrow> root n x) F
[PROOF STEP]
.


[STATEMENT]
lemma ordinal_minus_monoL: "x \<le> y \<Longrightarrow> x - z \<le> y - (z::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x - z \<le> y - z
[PROOF STEP]
by (erule continuous.monoD[OF continuous_minus])


[STATEMENT]
lemma rot_img_eq:
  assumes "0 < d"
  shows "(cubeImage (circle_cube )) = (cubeImage (rot_circle_cube))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cubeImage circle_cube = cubeImage rot_circle_cube
[PROOF STEP]
apply(auto simp add: cubeImage_def image_def cbox_def real_pair_basis)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>0 \<le> aa; aa \<le> 1; 0 \<le> ba; ba \<le> 1; (a, b) = circle_cube (aa, ba)\<rbrakk> \<Longrightarrow> \<exists>a\<ge>0. a \<le> 1 \<and> (\<exists>b\<ge>0. b \<le> 1 \<and> circle_cube (aa, ba) = rot_circle_cube (a, b))
 2. \<And>a b aa ba. \<lbrakk>0 \<le> aa; aa \<le> 1; 0 \<le> ba; ba \<le> 1; (a, b) = rot_circle_cube (aa, ba)\<rbrakk> \<Longrightarrow> \<exists>a\<ge>0. a \<le> 1 \<and> (\<exists>b\<ge>0. b \<le> 1 \<and> rot_circle_cube (aa, ba) = circle_cube (a, b))
[PROOF STEP]
by (meson rot_y_ivl rot_x_ivl assms circle_eq_rot_circle rot_circle_eq_circle)+


[STATEMENT]
lemma add_right_zero: "a + 0 = (a::'a::comm_monoid_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (0::'a) = a
[PROOF STEP]
by simp


[STATEMENT]
lemma R1_R3_commute: "(R1 o R3) = (R3 o R1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R1 \<circ> R3 = R3 \<circ> R1
[PROOF STEP]
by (auto simp: rp_defs design_defs fun_eq_iff split: cond_splits)


[STATEMENT]
lemma set_decode_div_2: "set_decode (x div 2) = Suc -` set_decode x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_decode (x div 2) = Suc -` set_decode x
[PROOF STEP]
by auto


[STATEMENT]
lemma real_diag_decompD[simp]:
  assumes "real_diag_decomp A B U"
  shows "unitary_diag A B U"
    "(\<forall>i < dim_row B. B$$(i, i) \<in> Reals)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary_diag A B U &&& \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
real_diag_decomp A B U

goal (1 subgoal):
 1. unitary_diag A B U &&& \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
unfolding real_diag_decomp_def unitary_diag_def
[PROOF STATE]
proof (prove)
using this:
(unitarily_equiv A B U \<and> diagonal_mat B) \<and> (\<forall>i<dim_row B. B $$ (i, i) \<in> \<real>)

goal (1 subgoal):
 1. unitarily_equiv A B U \<and> diagonal_mat B &&& \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
by auto


[STATEMENT]
lemma word_div_eq_1_iff: "n div m = 1 \<longleftrightarrow> n \<ge> m \<and> unat n < 2 * unat (m :: 'a :: len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n div m = 1) = (m \<le> n \<and> unat n < 2 * unat m)
[PROOF STEP]
apply (simp only: word_arith_nat_defs word_le_nat_alt word_of_nat_eq_iff flip: nat_div_eq_Suc_0_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take_bit LENGTH('a) (unat n div unat m) = take_bit LENGTH('a) (Suc 0)) = (unat n div unat m = Suc 0)
[PROOF STEP]
apply (simp flip: unat_div unsigned_take_bit_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma monomial1_monomial: "monomial1 (monomial n v) = (Var\<^sub>0 v::_\<Rightarrow>\<^sub>0('b::comm_semiring_1))^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial1 (monomial n v) = Var\<^sub>0 v ^ n
[PROOF STEP]
by (auto intro!: poly_mapping_eqI simp: monomial1_def Var\<^sub>0_power lookup_single when_def)


[STATEMENT]
lemma x_power_pm_minus_1:
  assumes x: "x \<in> carrier (mult_of R)"
  and "x [^]\<^bsub>(R)\<^esub> CARD('a) ^ m' = x"
  shows "x [^]\<^bsub>(R)\<^esub> (CARD('a) ^ m' - 1) = \<one>\<^bsub>(R)\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^]\<^bsub>R\<^esub> (CARD('a) ^ m' - 1) = \<one>\<^bsub>R\<^esub>
[PROOF STEP]
by (metis (no_types, lifting) One_nat_def Suc_pred assms(2) carrier_mult_of field_R.Units_closed
      field_R.Units_l_cancel field_R.field_Units field_R.l_one field_R.m_rcancel field_R.nat_pow_Suc
      field_R.nat_pow_closed field_R.one_closed field_R.r_null field_R.r_one x zero_less_card_finite
      zero_less_power)


[STATEMENT]
lemma SA_Units_memE:
  assumes "f \<in> (Units (SA n))"
  shows "f \<otimes>\<^bsub>SA n\<^esub> inv\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>"
        "inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>SA n\<^esub> inv\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub> &&& inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>
[PROOF STEP]
using assms SA_is_monoid[of n] monoid.Units_r_inv[of "SA n" f]
[PROOF STATE]
proof (prove)
using this:
f \<in> Units (SA n)
Group.monoid (SA n)
\<lbrakk>Group.monoid (SA n); f \<in> Units (SA n)\<rbrakk> \<Longrightarrow> f \<otimes>\<^bsub>SA n\<^esub> inv\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>

goal (1 subgoal):
 1. f \<otimes>\<^bsub>SA n\<^esub> inv\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub> &&& inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>
[PROOF STEP]
using assms SA_is_monoid[of n] monoid.Units_l_inv[of "SA n" f]
[PROOF STATE]
proof (prove)
using this:
f \<in> Units (SA n)
Group.monoid (SA n)
\<lbrakk>Group.monoid (SA n); f \<in> Units (SA n)\<rbrakk> \<Longrightarrow> inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>SA n\<^esub> f \<otimes>\<^bsub>SA n\<^esub> f = \<one>\<^bsub>SA n\<^esub>
[PROOF STEP]
by blast


[STATEMENT]
lemma omega_mult_omega_star:
  "x\<^sup>\<omega> * x\<^sup>\<omega>\<^sup>\<star> = x\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<omega>\<^sup>+ = x\<^sup>\<omega>
[PROOF STEP]
by (simp add: order.antisym star.circ_mult_increasing omega_sub_vector)


[STATEMENT]
lemma mod7_lm: "(n::nat) mod 7 = 0 \<or>
                (n::nat) mod 7 = 1 \<or>
                (n::nat) mod 7 = 2 \<or>
                (n::nat) mod 7 = 3 \<or>
                (n::nat) mod 7 = 4 \<or>
                (n::nat) mod 7 = 5 \<or>
                (n::nat) mod 7 = 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod 7 = 0 \<or> n mod 7 = 1 \<or> n mod 7 = 2 \<or> n mod 7 = 3 \<or> n mod 7 = 4 \<or> n mod 7 = 5 \<or> n mod 7 = 6
[PROOF STEP]
by arith


[STATEMENT]
lemma (in wf_digraph) trail_connected:
  assumes "connected G" "trail u p v" "set p \<noteq> arcs G"
  shows "\<exists>e. e \<in> arcs G - set p \<and> (tail G e \<in> set (awalk_verts u p) \<or> head G e \<in> set (awalk_verts u p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e. e \<in> arcs G - set p \<and> (tail G e \<in> set (awalk_verts u p) \<or> head G e \<in> set (awalk_verts u p))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Digraph_Component.connected G
trail u p v
set p \<noteq> arcs G

goal (1 subgoal):
 1. \<exists>e. e \<in> arcs G - set p \<and> (tail G e \<in> set (awalk_verts u p) \<or> head G e \<in> set (awalk_verts u p))
[PROOF STEP]
by (intro awalk_connected) (auto simp: trail_def)


[STATEMENT]
lemma wfp_on_mono:
  "A \<subseteq> B \<Longrightarrow> (\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> P x y \<Longrightarrow> Q x y) \<Longrightarrow> wfp_on Q B \<Longrightarrow> wfp_on P A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; \<And>x y. \<lbrakk>x \<in> A; y \<in> A; P x y\<rbrakk> \<Longrightarrow> Q x y; wfp_on Q B\<rbrakk> \<Longrightarrow> wfp_on P A
[PROOF STEP]
unfolding wfp_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; \<And>x y. \<lbrakk>x \<in> A; y \<in> A; P x y\<rbrakk> \<Longrightarrow> Q x y; \<nexists>f. \<forall>i. f i \<in> B \<and> Q (f (Suc i)) (f i)\<rbrakk> \<Longrightarrow> \<nexists>f. \<forall>i. f i \<in> A \<and> P (f (Suc i)) (f i)
[PROOF STEP]
by (metis subsetD)


[STATEMENT]
lemma (in abelian_group) a_repr_independence:
  "\<lbrakk> y \<in> H +> x; x \<in> carrier G; subgroup H (add_monoid G) \<rbrakk> \<Longrightarrow>
     H +> x = H +> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> H +> x; x \<in> carrier G; subgroup H (add_monoid G)\<rbrakk> \<Longrightarrow> H +> x = H +> y
[PROOF STEP]
using a_repr_independence'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> ?H #>\<^bsub>add_monoid G\<^esub> ?x; ?x \<in> carrier G; subgroup ?H (add_monoid G)\<rbrakk> \<Longrightarrow> ?H #>\<^bsub>add_monoid G\<^esub> ?x = ?H #>\<^bsub>add_monoid G\<^esub> ?y

goal (1 subgoal):
 1. \<lbrakk>y \<in> H +> x; x \<in> carrier G; subgroup H (add_monoid G)\<rbrakk> \<Longrightarrow> H +> x = H +> y
[PROOF STEP]
by (simp add: a_r_coset_def)


[STATEMENT]
lemma (in aGroup) addition2:"\<lbrakk>f \<in> {j. j \<le> (Suc n)} \<rightarrow> carrier A;
  h \<in> {j. j \<le> (Suc n)} \<rightarrow> {j. j \<le> (Suc n)}; inj_on h {j. j \<le> (Suc n)}\<rbrakk> \<Longrightarrow>
  nsum A (cmp f h) (Suc n) = nsum A f (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> Suc n} \<rightarrow> carrier A; h \<in> {j. j \<le> Suc n} \<rightarrow> {j. j \<le> Suc n}; inj_on h {j. j \<le> Suc n}\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A cmp f h Suc n = \<Sigma>\<^sub>e A f Suc n
[PROOF STEP]
apply (simp del:nsum_suc add:additionTr2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ereal_of_enat_add: "ereal_of_enat (m + n) = ereal_of_enat m + ereal_of_enat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal_of_enat (m + n) = ereal_of_enat m + ereal_of_enat n
[PROOF STEP]
by (cases m n rule: enat2_cases) auto


[STATEMENT]
lemma poincare_line_x_axis:
  assumes "x \<in> unit_disc" "y \<in> unit_disc" "x \<in> circline_set x_axis" "y \<in> circline_set x_axis" "x \<noteq> y"
  shows "poincare_line x y = x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_line x y = x_axis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> unit_disc
y \<in> unit_disc
x \<in> circline_set x_axis
y \<in> circline_set x_axis
x \<noteq> y

goal (1 subgoal):
 1. poincare_line x y = x_axis
[PROOF STEP]
using unique_poincare_line
[PROOF STATE]
proof (prove)
using this:
x \<in> unit_disc
y \<in> unit_disc
x \<in> circline_set x_axis
y \<in> circline_set x_axis
x \<noteq> y
\<lbrakk>?u \<noteq> ?v; ?u \<in> unit_disc; ?v \<in> unit_disc; ?u \<in> circline_set ?l; ?v \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line ?u ?v

goal (1 subgoal):
 1. poincare_line x y = x_axis
[PROOF STEP]
by auto


[STATEMENT]
lemma real_nat_list: "real (foldr (+) ( map f xs) (c::nat))
     = foldr (+) (map (\<lambda> x. real(f x))xs) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (foldr (+) (map f xs) c) = foldr (+) (map (\<lambda>x. real (f x)) xs) (real c)
[PROOF STEP]
by(induction xs arbitrary: c) auto


[STATEMENT]
lemma fls_subdegree_pow:
  fixes   f :: "'a::semiring_1_no_zero_divisors fls"
  shows   "fls_subdegree (f ^ n) = n * fls_subdegree f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_subdegree (f ^ n) = int n * fls_subdegree f
[PROOF STEP]
proof (cases "f=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> fls_subdegree (f ^ n) = int n * fls_subdegree f
 2. f \<noteq> 0 \<Longrightarrow> fls_subdegree (f ^ n) = int n * fls_subdegree f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> fls_subdegree (f ^ n) = int n * fls_subdegree f
 2. f \<noteq> 0 \<Longrightarrow> fls_subdegree (f ^ n) = int n * fls_subdegree f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

goal (1 subgoal):
 1. fls_subdegree (f ^ n) = int n * fls_subdegree f
[PROOF STEP]
by (induct n) (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
fls_subdegree (f ^ n) = int n * fls_subdegree f

goal (1 subgoal):
 1. f = 0 \<Longrightarrow> fls_subdegree (f ^ n) = int n * fls_subdegree f
[PROOF STEP]
qed (cases "n=0", auto simp: zero_power)


[STATEMENT]
lemma "c \<noteq> 0 \<Longrightarrow> p > q \<Longrightarrow> (\<lambda>x::real. c * x powr p * ln x powr r) \<in> \<omega>(\<lambda>x::real. x powr q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> 0; q < p\<rbrakk> \<Longrightarrow> (\<lambda>x. c * x powr p * ln x powr r) \<in> \<omega>(\<lambda>x. x powr q)
[PROOF STEP]
by simp


[STATEMENT]
lemma dim_row_transfer_rule:
  "HMA_M A (A' :: 'a ^ 'nc:: mod_type ^ 'nr:: mod_type) \<Longrightarrow> (=) (dim_row A) (CARD('nr))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M A A' \<Longrightarrow> dim_row A = CARD('nr)
[PROOF STEP]
unfolding HMA_M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = Mod_Type_Connect.from_hma\<^sub>m A' \<Longrightarrow> dim_row A = CARD('nr)
[PROOF STEP]
by auto


[STATEMENT]
lemma content_smult [simp]:
  fixes c :: "'a :: {normalization_semidom_multiplicative, semiring_gcd}"
  shows "content (smult c p) = normalize c * content p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (smult c p) = normalize c * content p
[PROOF STEP]
by (simp add: content_def coeffs_smult Gcd_fin_mult normalize_mult)


[STATEMENT]
lemma out_arcs_add_arc_iff:
  "out_arcs (add_arc a) u = (if tail G a = u then insert a (out_arcs G u) else out_arcs G u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. out_arcs (add_arc a) u = (if tail G a = u then insert a (out_arcs G u) else out_arcs G u)
[PROOF STEP]
by auto


[STATEMENT]
lemma sqrt_int[simp]: "set (sqrt_int x) = {y. y * y = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sqrt_int x) = {y. y * y = x}
[PROOF STEP]
unfolding sqrt_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (root_int 2 x) = {y. y * y = x}
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma height_node31:
  "height m > 0 \<Longrightarrow> height(node31 l a m b r) =
   max (height l) (max (height m) (height r)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> height (node31 l a m b r) = max (height l) (max (height m) (height r)) + 1
[PROOF STEP]
by(induct l a m b r rule: node31.induct)(simp_all add: max_def)


[STATEMENT]
lemma arcosh_1 [simp]: "arcosh 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcosh (1::'a) = (0::'a)
[PROOF STEP]
by (simp add: arcosh_def)


[STATEMENT]
lemma Infinitesimal_HComplex:
  assumes x: "x \<in> Infinitesimal" and y: "y \<in> Infinitesimal"
  shows "HComplex x y \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
have "hcmod (HComplex 0 y) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcmod (HComplex 0 y) \<in> Infinitesimal
[PROOF STEP]
by (simp add: hcmod_i y)
[PROOF STATE]
proof (state)
this:
hcmod (HComplex 0 y) \<in> Infinitesimal

goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
hcmod (HComplex 0 y) \<in> Infinitesimal

goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
have "hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal
[PROOF STEP]
using Infinitesimal_hcmod_iff Infinitesimal_of_hypreal_iff x
[PROOF STATE]
proof (prove)
using this:
(?z \<in> Infinitesimal) = (hcmod ?z \<in> Infinitesimal)
(of_hypreal ?x \<in> Infinitesimal) = (?x \<in> Infinitesimal)
x \<in> Infinitesimal

goal (1 subgoal):
 1. hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal

goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
hcmod (HComplex 0 y) \<in> Infinitesimal
hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal
[PROOF STEP]
have "hcmod (HComplex x y) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
using this:
hcmod (HComplex 0 y) \<in> Infinitesimal
hcmod (hcomplex_of_hypreal x) \<in> Infinitesimal

goal (1 subgoal):
 1. hcmod (HComplex x y) \<in> Infinitesimal
[PROOF STEP]
by (metis Infinitesimal_add Infinitesimal_hcmod_iff add.right_neutral hcomplex_of_hypreal_add_HComplex)
[PROOF STATE]
proof (state)
this:
hcmod (HComplex x y) \<in> Infinitesimal

goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hcmod (HComplex x y) \<in> Infinitesimal
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hcmod (HComplex x y) \<in> Infinitesimal

goal (1 subgoal):
 1. HComplex x y \<in> Infinitesimal
[PROOF STEP]
by (simp add: Infinitesimal_hnorm_iff)
[PROOF STATE]
proof (state)
this:
HComplex x y \<in> Infinitesimal

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem assumes ms: "measure_space M" shows
  rv_le_iff: "(f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
have "f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
assume "f \<in> measurable (measurable_sets M) \<bool>"
[PROOF STATE]
proof (state)
this:
f \<in> measurable (measurable_sets M) \<bool>

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
hence "\<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
f \<in> measurable (measurable_sets M) \<bool>

goal (1 subgoal):
 1. \<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M
[PROOF STEP]
by (unfold measurable_def) blast
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
have "{..a} \<in> \<bool>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..a} \<in> \<bool>
[PROOF STEP]
by (simp only: Borelsets_def) (rule sigma.basic, blast)
[PROOF STATE]
proof (state)
this:
{..a} \<in> \<bool>

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M
{..a} \<in> \<bool>
[PROOF STEP]
have "{w. f w \<le> a} \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>\<bool>. f -` b \<in> measurable_sets M
{..a} \<in> \<bool>

goal (1 subgoal):
 1. {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
by (auto simp add: vimage_def)
[PROOF STATE]
proof (state)
this:
{w. f w \<le> a} \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
f \<in> measurable (measurable_sets M) \<bool> \<Longrightarrow> {w. f w \<le> ?a2} \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
thus "\<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
f \<in> measurable (measurable_sets M) \<bool> \<Longrightarrow> {w. f w \<le> ?a2} \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>a. f \<in> rv M \<Longrightarrow> {w. f w \<le> a} \<in> measurable_sets M
[PROOF STEP]
by (simp add: rv_def)
[PROOF STATE]
proof (state)
this:
f \<in> rv M \<Longrightarrow> {w. f w \<le> ?a} \<in> measurable_sets M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M

goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M

goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
have "\<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
assume "\<forall>a. {w. f w \<le> a} \<in> measurable_sets M"
[PROOF STATE]
proof (state)
this:
\<forall>a. {w. f w \<le> a} \<in> measurable_sets M

goal (1 subgoal):
 1. \<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
hence "f \<in> measurable (measurable_sets M){S. \<exists>u. S={..u}}"
[PROOF STATE]
proof (prove)
using this:
\<forall>a. {w. f w \<le> a} \<in> measurable_sets M

goal (1 subgoal):
 1. f \<in> measurable (measurable_sets M) {S. \<exists>u. S = {..u}}
[PROOF STEP]
by (auto simp add: measurable_def vimage_def)
[PROOF STATE]
proof (state)
this:
f \<in> measurable (measurable_sets M) {S. \<exists>u. S = {..u}}

goal (1 subgoal):
 1. \<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
with ms
[PROOF STATE]
proof (chain)
picking this:
measure_space M
f \<in> measurable (measurable_sets M) {S. \<exists>u. S = {..u}}
[PROOF STEP]
have "f \<in> measurable (measurable_sets M) \<bool>"
[PROOF STATE]
proof (prove)
using this:
measure_space M
f \<in> measurable (measurable_sets M) {S. \<exists>u. S = {..u}}

goal (1 subgoal):
 1. f \<in> measurable (measurable_sets M) \<bool>
[PROOF STEP]
by (simp only: Borelsets_def measure_space_def measurable_lift)
[PROOF STATE]
proof (state)
this:
f \<in> measurable (measurable_sets M) \<bool>

goal (1 subgoal):
 1. \<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
with ms
[PROOF STATE]
proof (chain)
picking this:
measure_space M
f \<in> measurable (measurable_sets M) \<bool>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_space M
f \<in> measurable (measurable_sets M) \<bool>

goal (1 subgoal):
 1. f \<in> rv M
[PROOF STEP]
by (auto simp add: rv_def)
[PROOF STATE]
proof (state)
this:
f \<in> rv M

goal:
No subgoals!
[PROOF STEP]
txt\<open>\nopagebreak\<close>
[PROOF STATE]
proof (state)
this:
f \<in> rv M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M

goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M
\<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> rv M \<Longrightarrow> \<forall>a. {w. f w \<le> a} \<in> measurable_sets M
\<forall>a. {w. f w \<le> a} \<in> measurable_sets M \<Longrightarrow> f \<in> rv M

goal (1 subgoal):
 1. (f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
(f \<in> rv M) = (\<forall>a. {w. f w \<le> a} \<in> measurable_sets M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma idx_of_props:
  assumes
    p_disjoint_sym: "\<forall>i j v. i<length p \<and> j<length p \<and> v\<in>p!i \<and> v\<in>p!j \<longrightarrow> i=j"
  assumes ON_STACK: "v\<in>\<Union>(set p)"
  shows
    "idx_of p v < length p" and
    "v \<in> p ! idx_of p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. idx_of p v < length p &&& v \<in> p ! idx_of p v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. idx_of p v < length p
 2. v \<in> p ! idx_of p v
[PROOF STEP]
from ON_STACK
[PROOF STATE]
proof (chain)
picking this:
v \<in> \<Union> (set p)
[PROOF STEP]
obtain i where "i<length p" "v \<in> p ! i"
[PROOF STATE]
proof (prove)
using this:
v \<in> \<Union> (set p)

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length p; v \<in> p ! i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
i < length p
v \<in> p ! i

goal (2 subgoals):
 1. idx_of p v < length p
 2. v \<in> p ! idx_of p v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i < length p
v \<in> p ! i

goal (2 subgoals):
 1. idx_of p v < length p
 2. v \<in> p ! idx_of p v
[PROOF STEP]
hence "\<forall>j<length p. v\<in>p ! j \<longrightarrow> i=j"
[PROOF STATE]
proof (prove)
using this:
i < length p
v \<in> p ! i

goal (1 subgoal):
 1. \<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j
[PROOF STEP]
using p_disjoint_sym
[PROOF STATE]
proof (prove)
using this:
i < length p
v \<in> p ! i
\<forall>i j v. i < length p \<and> j < length p \<and> v \<in> p ! i \<and> v \<in> p ! j \<longrightarrow> i = j

goal (1 subgoal):
 1. \<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j

goal (2 subgoals):
 1. idx_of p v < length p
 2. v \<in> p ! idx_of p v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i < length p
v \<in> p ! i
\<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j
[PROOF STEP]
show "idx_of p v < length p"
    and "v \<in> p ! idx_of p v"
[PROOF STATE]
proof (prove)
using this:
i < length p
v \<in> p ! i
\<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j

goal (1 subgoal):
 1. idx_of p v < length p &&& v \<in> p ! idx_of p v
[PROOF STEP]
unfolding idx_of_def
[PROOF STATE]
proof (prove)
using this:
i < length p
v \<in> p ! i
\<forall>j<length p. v \<in> p ! j \<longrightarrow> i = j

goal (1 subgoal):
 1. (THE i. i < length p \<and> v \<in> p ! i) < length p &&& v \<in> p ! (THE i. i < length p \<and> v \<in> p ! i)
[PROOF STEP]
by (metis (lifting) theI')+
[PROOF STATE]
proof (state)
this:
idx_of p v < length p
v \<in> p ! idx_of p v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma single_valued_UN_chain:
  assumes "chain S" "(!!n. single_valued (S n))"
  shows "single_valued(UN n. S n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued (\<Union> (range S))
[PROOF STEP]
proof(auto simp: single_valued_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y xa z xb. \<lbrakk>(x, y) \<in> S xa; (x, z) \<in> S xb\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
fix m n x y z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y xa z xb. \<lbrakk>(x, y) \<in> S xa; (x, z) \<in> S xb\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
assume "(x, y) \<in> S m" "(x, z) \<in> S n"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> S m
(x, z) \<in> S n

goal (1 subgoal):
 1. \<And>x y xa z xb. \<lbrakk>(x, y) \<in> S xa; (x, z) \<in> S xb\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
with chain_total[OF assms(1), of m n] assms(2)
[PROOF STATE]
proof (chain)
picking this:
S m \<subseteq> S n \<or> S n \<subseteq> S m
single_valued (S ?n)
(x, y) \<in> S m
(x, z) \<in> S n
[PROOF STEP]
show "y = z"
[PROOF STATE]
proof (prove)
using this:
S m \<subseteq> S n \<or> S n \<subseteq> S m
single_valued (S ?n)
(x, y) \<in> S m
(x, z) \<in> S n

goal (1 subgoal):
 1. y = z
[PROOF STEP]
by (auto simp: single_valued_def)
[PROOF STATE]
proof (state)
this:
y = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antisymmetric_cong:
  "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> r a b \<longleftrightarrow> r' a b) \<Longrightarrow> antisymmetric A r \<longleftrightarrow> antisymmetric A r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> r a b = r' a b) \<Longrightarrow> antisymmetric A r = antisymmetric A r'
[PROOF STEP]
by (auto simp: antisymmetric_def)


[STATEMENT]
lemma subst_fm_UnionP [simp]:
  "(UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
obtain j::name where "atom j \<sharp> (x,y,z,i,u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. atom j \<sharp> (x, y, z, i, u) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom j \<sharp> (x, y, z, i, u)

goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom j \<sharp> (x, y, z, i, u)

goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
by (auto simp: UnionP.simps [of j])
[PROOF STATE]
proof (state)
this:
(UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transitive_linorder_matrix:
  fixes f :: "('a::finite,'b::linorder_stone_relation_algebra_expansion) square"
  shows "matrix_idempotent_semiring.transitive f \<longleftrightarrow> (\<forall>i j k . f (i,k) \<le> f (i,j) \<or> f (k,j) \<le> f (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
have "matrix_idempotent_semiring.transitive f \<longleftrightarrow> (\<forall>i j . (\<Squnion>\<^sub>k f (i,k) * f (k,j)) \<le> f (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j))
[PROOF STEP]
by (simp add: times_matrix_def less_eq_matrix_def)
[PROOF STATE]
proof (state)
this:
matrix_idempotent_semiring.transitive f = (\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_idempotent_semiring.transitive f = (\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
have "... \<longleftrightarrow> (\<forall>i j k . f (i,k) * f (k,j) \<le> f (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j)) = (\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j))
[PROOF STEP]
by (simp add: lub_sum_iff)
[PROOF STATE]
proof (state)
this:
(\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j)) = (\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>i j. sup_monoid.sum (\<lambda>k. f (i, k) * f (k, j)) {k. True} \<le> f (i, j)) = (\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
have "... \<longleftrightarrow> (\<forall>i j k . f (i,k) \<le> f (i,j) \<or> f (k,j) \<le> f (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j)) = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
using inf_less_eq
[PROOF STATE]
proof (prove)
using this:
(?x \<sqinter> ?y \<le> ?z) = (?x \<le> ?z \<or> ?y \<le> ?z)

goal (1 subgoal):
 1. (\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j)) = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<forall>i j k. f (i, k) * f (k, j) \<le> f (i, j)) = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))

goal (1 subgoal):
 1. matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_idempotent_semiring.transitive f = (\<forall>i j k. f (i, k) \<le> f (i, j) \<or> f (k, j) \<le> f (i, j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma variety_of_ideal [simp]: "\<V> (ideal F) = \<V> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<V> (ideal F) = \<V> F
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<V> (ideal F) \<subseteq> \<V> F
 2. \<V> F \<subseteq> \<V> (ideal F)
[PROOF STEP]
show "\<V> (ideal F) \<subseteq> \<V> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<V> (ideal F) \<subseteq> \<V> F
[PROOF STEP]
by (intro variety_of_antimono ideal.span_superset)
[PROOF STATE]
proof (state)
this:
\<V> (ideal F) \<subseteq> \<V> F

goal (1 subgoal):
 1. \<V> F \<subseteq> \<V> (ideal F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<V> F \<subseteq> \<V> (ideal F)
[PROOF STEP]
show "\<V> F \<subseteq> \<V> (ideal F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<V> F \<subseteq> \<V> (ideal F)
[PROOF STEP]
proof (intro subsetI variety_ofI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x f. \<lbrakk>x \<in> \<V> F; f \<in> ideal F\<rbrakk> \<Longrightarrow> poly_eval x f = (0::'b)
[PROOF STEP]
fix a f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x f. \<lbrakk>x \<in> \<V> F; f \<in> ideal F\<rbrakk> \<Longrightarrow> poly_eval x f = (0::'b)
[PROOF STEP]
assume "a \<in> \<V> F" and "f \<in> ideal F"
[PROOF STATE]
proof (state)
this:
a \<in> \<V> F
f \<in> ideal F

goal (1 subgoal):
 1. \<And>x f. \<lbrakk>x \<in> \<V> F; f \<in> ideal F\<rbrakk> \<Longrightarrow> poly_eval x f = (0::'b)
[PROOF STEP]
from this(2)
[PROOF STATE]
proof (chain)
picking this:
f \<in> ideal F
[PROOF STEP]
show "poly_eval a f = 0"
[PROOF STATE]
proof (prove)
using this:
f \<in> ideal F

goal (1 subgoal):
 1. poly_eval a f = (0::'b)
[PROOF STEP]
proof (induct f rule: ideal.span_induct_alt)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_eval a 0 = (0::'b)
 2. \<And>c x y. \<lbrakk>x \<in> F; poly_eval a y = (0::'b)\<rbrakk> \<Longrightarrow> poly_eval a (c * x + y) = (0::'b)
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. poly_eval a 0 = (0::'b)
 2. \<And>c x y. \<lbrakk>x \<in> F; poly_eval a y = (0::'b)\<rbrakk> \<Longrightarrow> poly_eval a (c * x + y) = (0::'b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a 0 = (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_eval a 0 = (0::'b)

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> F; poly_eval a y = (0::'b)\<rbrakk> \<Longrightarrow> poly_eval a (c * x + y) = (0::'b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> F; poly_eval a y = (0::'b)\<rbrakk> \<Longrightarrow> poly_eval a (c * x + y) = (0::'b)
[PROOF STEP]
case (step c f g)
[PROOF STATE]
proof (state)
this:
f \<in> F
poly_eval a g = (0::'b)

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> F; poly_eval a y = (0::'b)\<rbrakk> \<Longrightarrow> poly_eval a (c * x + y) = (0::'b)
[PROOF STEP]
with \<open>a \<in> \<V> F\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> \<V> F
f \<in> F
poly_eval a g = (0::'b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<in> \<V> F
f \<in> F
poly_eval a g = (0::'b)

goal (1 subgoal):
 1. poly_eval a (c * f + g) = (0::'b)
[PROOF STEP]
by (auto simp: poly_eval_plus poly_eval_times dest: variety_ofD)
[PROOF STATE]
proof (state)
this:
poly_eval a (c * f + g) = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly_eval a f = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<V> F \<subseteq> \<V> (ideal F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma io_targets_finite :
  "finite (io_targets M io q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
have "(io_targets M io q) \<subseteq> {target q p | p . path M q p \<and> length p \<le> length io}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}
[PROOF STEP]
unfolding io_targets.simps length_map[of "(\<lambda> t . (t_input t, t_output t))", symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {target q p |p. path M q p \<and> p_io p = io} \<subseteq> {target q p |p. path M q p \<and> length (p_io p) \<le> length io}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}

goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}

goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
have "finite {target q p | p . path M q p \<and> length p \<le> length io}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {target q p |p. path M q p \<and> length p \<le> length io}
[PROOF STEP]
using paths_finite[of M q "length io"]
[PROOF STATE]
proof (prove)
using this:
finite {p. path M q p \<and> length p \<le> length io}

goal (1 subgoal):
 1. finite {target q p |p. path M q p \<and> length p \<le> length io}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {target q p |p. path M q p \<and> length p \<le> length io}

goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}
finite {target q p |p. path M q p \<and> length p \<le> length io}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}
finite {target q p |p. path M q p \<and> length p \<le> length io}

goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
using rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
io_targets M io q \<subseteq> {target q p |p. path M q p \<and> length p \<le> length io}
finite {target q p |p. path M q p \<and> length p \<le> length io}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite (io_targets M io q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (io_targets M io q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_lebesgue_integral_gt_eq':
  fixes a b f
  assumes "a > b"
  shows "interval_lebesgue_integral M a b f = - interval_lebesgue_integral M b a f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral M a b f = - interval_lebesgue_integral M b a f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b < a

goal (1 subgoal):
 1. interval_lebesgue_integral M a b f = - interval_lebesgue_integral M b a f
[PROOF STEP]
by (auto simp: interval_lebesgue_integral_def less_imp_le einterval_def)


[STATEMENT]
lemma coprime_diff_one_right_nat [simp]:
  "coprime n (n - 1)" if "n > 0" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime n (n - 1)
[PROOF STEP]
using that coprime_diff_one_left_nat [of n]
[PROOF STATE]
proof (prove)
using this:
0 < n
0 < n \<Longrightarrow> coprime (n - 1) n

goal (1 subgoal):
 1. coprime n (n - 1)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma fft_3: assumes dx: "dim_vec x = 3"
  and be: "x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = True"
  shows "ceros_of_boolean_input x = {0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 3
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = True

goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 3
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = True

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1}
[PROOF STEP]
using less_3_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 3
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = True
?n < 3 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma lower_rank_of_le: "lower_rank_of \<E> \<le> card \<E>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
have "\<exists>n \<in> {card B | B. basis_in \<E> B}. n \<le> card \<E>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
[PROOF STEP]
using card_mono[OF \<E>.carrier_finite basis_in_subset_carrier[OF *]] basis_in_ex[OF *]
[PROOF STATE]
proof (prove)
using this:
basis_in \<E> ?A \<Longrightarrow> card ?A \<le> card \<E>
\<exists>B. basis_in \<E> B

goal (1 subgoal):
 1. \<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>

goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>

goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
have "finite {card B | B. basis_in \<E> B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {card B |B. basis_in \<E> B}
[PROOF STEP]
using collect_basis_in_finite
[PROOF STATE]
proof (prove)
using this:
finite (Collect (basis_in \<E>))

goal (1 subgoal):
 1. finite {card B |B. basis_in \<E> B}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {card B |B. basis_in \<E> B}

goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
finite {card B |B. basis_in \<E> B}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
finite {card B |B. basis_in \<E> B}

goal (1 subgoal):
 1. lower_rank_of \<E> \<le> card \<E>
[PROOF STEP]
unfolding lower_rank_of_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
finite {card B |B. basis_in \<E> B}

goal (1 subgoal):
 1. Min {card B |B. basis_in \<E> B} \<le> card \<E>
[PROOF STEP]
using basis_ex Min_le_iff
[PROOF STATE]
proof (prove)
using this:
\<exists>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
finite {card B |B. basis_in \<E> B}
Ex basis
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> (Min ?A \<le> ?x) = (\<exists>a\<in>?A. a \<le> ?x)

goal (1 subgoal):
 1. Min {card B |B. basis_in \<E> B} \<le> card \<E>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lower_rank_of \<E> \<le> card \<E>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_list_all2_nthD:
  "\<lbrakk> list_all2 (fun_of S) xs ys; p < size xs \<rbrakk> \<Longrightarrow> (xs!p,ys!p) \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
by (drule list_all2_nthD) auto


[STATEMENT]
lemma floor_frac [simp]: "\<lfloor>frac r\<rfloor> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>frac r\<rfloor> = 0
[PROOF STEP]
by (simp add: frac_def)


[STATEMENT]
lemma canon_ang_minus_3pi_minus_pi:
  assumes "-3*pi < \<alpha>" and "\<alpha> \<le> -pi"
  shows "\<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi
[PROOF STEP]
have "\<exists>x. pi = pi * real_of_int x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. pi = pi * real_of_int x
[PROOF STEP]
by (rule_tac x="1" in exI, simp)
[PROOF STATE]
proof (state)
this:
\<exists>x. pi = pi * real_of_int x

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

goal (1 subgoal):
 1. \<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi
[PROOF STEP]
using assms canon_ang_eqI[of "\<alpha> + 2*pi" "\<alpha>"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x. pi = pi * real_of_int x
- 3 * pi < \<alpha>
\<alpha> \<le> - pi
\<lbrakk>\<exists>x. \<alpha> + 2 * pi - \<alpha> = 2 * real_of_int x * pi; - pi < \<alpha> + 2 * pi \<and> \<alpha> + 2 * pi \<le> pi\<rbrakk> \<Longrightarrow> \<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi

goal (1 subgoal):
 1. \<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<downharpoonright>\<alpha>\<downharpoonleft> = \<alpha> + 2 * pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_trm_subst_rangeI[intro]:
  "(\<And>x. wf\<^sub>t\<^sub>r\<^sub>m (\<delta> x)) \<Longrightarrow> wf\<^sub>t\<^sub>r\<^sub>m\<^sub>s (subst_range \<delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. wf\<^sub>t\<^sub>r\<^sub>m (\<delta> x)) \<Longrightarrow> wf\<^sub>t\<^sub>r\<^sub>m\<^sub>s (subst_range \<delta>)
[PROOF STEP]
by (metis wf_trm_subst_range_iff)


[STATEMENT]
lemma fcard_gt1_if_mdeg_gt_child:
  assumes "max_deg (Node r xs) > n" and "t1 \<in> fst ` fset xs" and "max_deg t1 \<le> n" and "n\<noteq>0"
  shows "fcard xs > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < fcard xs
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 1 < fcard xs \<Longrightarrow> False
[PROOF STEP]
assume "\<not>fcard xs > 1"
[PROOF STATE]
proof (state)
this:
\<not> 1 < fcard xs

goal (1 subgoal):
 1. \<not> 1 < fcard xs \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 1 < fcard xs
[PROOF STEP]
have "fcard xs \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < fcard xs

goal (1 subgoal):
 1. fcard xs \<le> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fcard xs \<le> 1

goal (1 subgoal):
 1. \<not> 1 < fcard xs \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fcard xs \<le> 1
[PROOF STEP]
have "\<exists>e1. xs = {|(t1,e1)|}"
[PROOF STATE]
proof (prove)
using this:
fcard xs \<le> 1

goal (1 subgoal):
 1. \<exists>e1. xs = {|(t1, e1)|}
[PROOF STEP]
using assms(2) singleton_if_fcard_le1_elem
[PROOF STATE]
proof (prove)
using this:
fcard xs \<le> 1
t1 \<in> fst ` fset xs
\<lbrakk>fcard ?xs \<le> 1; ?x \<in> fset ?xs\<rbrakk> \<Longrightarrow> ?xs = {|?x|}

goal (1 subgoal):
 1. \<exists>e1. xs = {|(t1, e1)|}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>e1. xs = {|(t1, e1)|}

goal (1 subgoal):
 1. \<not> 1 < fcard xs \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>e1. xs = {|(t1, e1)|}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<exists>e1. xs = {|(t1, e1)|}

goal (1 subgoal):
 1. False
[PROOF STEP]
using mdeg_singleton[of r t1] assms(1,3,4)
[PROOF STATE]
proof (prove)
using this:
\<exists>e1. xs = {|(t1, e1)|}
max_deg (Node r {|(t1, ?e1.0)|}) = max (max_deg t1) (fcard {|(t1, ?e1.0)|})
n < max_deg (Node r xs)
max_deg t1 \<le> n
n \<noteq> 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma free_tv_le_new_tv: "[| new_tv n t; m:free_tv t |] ==> m<n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>new_tv n t; m \<in> free_tv t\<rbrakk> \<Longrightarrow> m < n
[PROOF STEP]
unfolding new_tv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>m. m \<in> free_tv t \<longrightarrow> m < n; m \<in> free_tv t\<rbrakk> \<Longrightarrow> m < n
[PROOF STEP]
by blast


[STATEMENT]
lemma matrix_to_iarray_interchange_rows[code_unfold]:
  fixes A::"'a::{semiring_1}^'columns::{mod_type}^'rows::{mod_type}"
  shows "matrix_to_iarray (interchange_rows A i j) = interchange_rows_iarray (matrix_to_iarray A) (to_nat i) (to_nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (interchange_rows A i j) = interchange_rows_iarray (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j)
[PROOF STEP]
proof (unfold matrix_to_iarray_def interchange_rows_iarray_def o_def map_vec_to_iarray_rw, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
assume x_less_card: "x < CARD('rows)"
    and x_not_j: "x \<noteq> to_nat j" and x_not_i: "x \<noteq> to_nat i"
[PROOF STATE]
proof (state)
this:
x < CARD('rows)
x \<noteq> mod_type_class.to_nat j
x \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
show "vec_to_iarray (interchange_rows A i j $ from_nat x) = vec_to_iarray (A $ from_nat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
by (metis interchange_rows_preserves to_nat_from_nat_id x_less_card x_not_i x_not_j)
[PROOF STATE]
proof (state)
this:
vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totient_conv_totient_aux1:
  assumes "set ps = prime_factors n" "distinct ps"
  shows   "totient n = totient_aux1 n ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
set ps = prime_factors n
distinct ps
[PROOF STEP]
have "real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
using this:
set ps = prime_factors n
distinct ps

goal (1 subgoal):
 1. real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)
[PROOF STEP]
by (intro of_nat_totient_aux1) auto
[PROOF STATE]
proof (state)
this:
real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
have "set ps = prime_factors n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ps = prime_factors n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
set ps = prime_factors n

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set ps = prime_factors n

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
have "real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p) = real (totient n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p) = real (totient n)
[PROOF STEP]
by (rule totient_formula2 [symmetric])
[PROOF STATE]
proof (state)
this:
real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p) = real (totient n)

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (totient_aux1 n ps) = real (totient n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (totient_aux1 n ps) = real (totient n)

goal (1 subgoal):
 1. totient n = totient_aux1 n ps
[PROOF STEP]
by (simp only: of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
totient n = totient_aux1 n ps

goal:
No subgoals!
[PROOF STEP]
qed