[STATEMENT]
lemma llist_all2_lSupI:
  assumes "Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y" "\<forall>(xs, ys)\<in>Y. llist_all2 P xs ys"
  shows "llist_all2 P (lSup (fst ` Y)) (lSup (snd ` Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P (lSup (fst ` Y)) (lSup (snd ` Y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(xs, ys)\<in>Y. llist_all2 P xs ys

goal (1 subgoal):
 1. llist_all2 P (lSup (fst ` Y)) (lSup (snd ` Y))
[PROOF STEP]
proof(coinduction arbitrary: Y)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y\<rbrakk> \<Longrightarrow> lnull (lSup (fst ` Y)) = lnull (lSup (snd ` Y))
 2. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
case LNil
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y

goal (2 subgoals):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y\<rbrakk> \<Longrightarrow> lnull (lSup (fst ` Y)) = lnull (lSup (snd ` Y))
 2. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y

goal (1 subgoal):
 1. lnull (lSup (fst ` Y)) = lnull (lSup (snd ` Y))
[PROOF STEP]
by(auto dest: llist_all2_lnullD simp add: split_beta)
[PROOF STATE]
proof (state)
this:
lnull (lSup (fst ` Y)) = lnull (lSup (snd ` Y))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
case (LCons Y)
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
note chain = \<open>Complete_Partial_Order.chain _ Y\<close>
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
from LCons
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))
[PROOF STEP]
have Y: "\<And>xs ys. (xs, ys) \<in> Y \<Longrightarrow> llist_all2 P xs ys"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))

goal (1 subgoal):
 1. \<And>xs ys. (xs, ys) \<in> Y \<Longrightarrow> llist_all2 P xs ys
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(?xs, ?ys) \<in> Y \<Longrightarrow> llist_all2 P ?xs ?ys

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
from LCons
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))
[PROOF STEP]
obtain xs ys where xsysY: "(xs, ys) \<in> Y"
    and [simp]: "\<not> lnull xs" "\<not> lnull ys"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))

goal (1 subgoal):
 1. (\<And>xs ys. \<lbrakk>(xs, ys) \<in> Y; \<not> lnull xs; \<not> lnull ys\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto 4 3 dest: llist_all2_lnullD simp add: split_beta)
[PROOF STATE]
proof (state)
this:
(xs, ys) \<in> Y
\<not> lnull xs
\<not> lnull ys

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
from xsysY
[PROOF STATE]
proof (chain)
picking this:
(xs, ys) \<in> Y
[PROOF STEP]
have "lhd xs \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})"
[PROOF STATE]
proof (prove)
using this:
(xs, ys) \<in> Y

goal (1 subgoal):
 1. lhd xs \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})
[PROOF STEP]
by(auto intro: rev_image_eqI)
[PROOF STATE]
proof (state)
this:
lhd xs \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
hence "(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs"
[PROOF STATE]
proof (prove)
using this:
lhd xs \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})

goal (1 subgoal):
 1. (THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs
[PROOF STEP]
by(rule the_equality)(auto dest!: lprefix_lhdD chainD[OF chain xsysY])
[PROOF STATE]
proof (state)
this:
(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
from xsysY
[PROOF STATE]
proof (chain)
picking this:
(xs, ys) \<in> Y
[PROOF STEP]
have "lhd ys \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})"
[PROOF STATE]
proof (prove)
using this:
(xs, ys) \<in> Y

goal (1 subgoal):
 1. lhd ys \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})
[PROOF STEP]
by(auto intro: rev_image_eqI)
[PROOF STATE]
proof (state)
this:
lhd ys \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
hence "(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys"
[PROOF STATE]
proof (prove)
using this:
lhd ys \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})

goal (1 subgoal):
 1. (THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys
[PROOF STEP]
by(rule the_equality)(auto dest!: lprefix_lhdD chainD[OF chain xsysY])
[PROOF STATE]
proof (state)
this:
(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
from xsysY
[PROOF STATE]
proof (chain)
picking this:
(xs, ys) \<in> Y
[PROOF STEP]
have "llist_all2 P xs ys"
[PROOF STATE]
proof (prove)
using this:
(xs, ys) \<in> Y

goal (1 subgoal):
 1. llist_all2 P xs ys
[PROOF STEP]
by(rule Y)
[PROOF STATE]
proof (state)
this:
llist_all2 P xs ys

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
hence "P (lhd xs) (lhd ys)"
[PROOF STATE]
proof (prove)
using this:
llist_all2 P xs ys

goal (1 subgoal):
 1. P (lhd xs) (lhd ys)
[PROOF STEP]
by(rule llist_all2_lhdD) simp
[PROOF STATE]
proof (state)
this:
P (lhd xs) (lhd ys)

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs
(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys
P (lhd xs) (lhd ys)
[PROOF STEP]
have ?lhd
[PROOF STATE]
proof (prove)
using this:
(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs
(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys
P (lhd xs) (lhd ys)

goal (1 subgoal):
 1. P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))
[PROOF STEP]
using LCons
[PROOF STATE]
proof (prove)
using this:
(THE x. x \<in> lhd ` (fst ` Y \<inter> {xs. \<not> lnull xs})) = lhd xs
(THE x. x \<in> lhd ` (snd ` Y \<inter> {xs. \<not> lnull xs})) = lhd ys
P (lhd xs) (lhd ys)
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y
\<forall>(x, y)\<in>Y. llist_all2 P x y
\<not> lnull (lSup (fst ` Y))
\<not> lnull (lSup (snd ` Y))

goal (1 subgoal):
 1. P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
let ?Y = "map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
have "Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) (map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}))
[PROOF STEP]
by(rule chainI)(auto 4 3 dest: Y chainD[OF chain] intro: lprefix_ltlI)
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) (map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) (map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
have "ltl ` (fst ` Y \<inter> {xs. \<not> lnull xs}) = fst ` ?Y"
      and "ltl ` (snd ` Y \<inter> {xs. \<not> lnull xs}) = snd ` ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltl ` (fst ` Y \<inter> {xs. \<not> lnull xs}) = fst ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}) &&& ltl ` (snd ` Y \<inter> {xs. \<not> lnull xs}) = snd ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})
[PROOF STEP]
by(fastforce simp add: image_image dest: Y llist_all2_lnullD intro: rev_image_eqI)+
[PROOF STATE]
proof (state)
this:
ltl ` (fst ` Y \<inter> {xs. \<not> lnull xs}) = fst ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})
ltl ` (snd ` Y \<inter> {xs. \<not> lnull xs}) = snd ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) (map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}))
ltl ` (fst ` Y \<inter> {xs. \<not> lnull xs}) = fst ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})
ltl ` (snd ` Y \<inter> {xs. \<not> lnull xs}) = snd ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})
[PROOF STEP]
have ?ltl
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) (map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys}))
ltl ` (fst ` Y \<inter> {xs. \<not> lnull xs}) = fst ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})
ltl ` (snd ` Y \<inter> {xs. \<not> lnull xs}) = snd ` map_prod ltl ltl ` (Y \<inter> {(xs, ys). \<not> lnull xs \<and> \<not> lnull ys})

goal (1 subgoal):
 1. (\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y)))
[PROOF STEP]
by(auto 4 3 intro: llist_all2_ltlI dest: Y)
[PROOF STATE]
proof (state)
this:
(\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y)))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y)))

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y; \<forall>(x, y)\<in>Y. llist_all2 P x y; \<not> lnull (lSup (fst ` Y)); \<not> lnull (lSup (snd ` Y))\<rbrakk> \<Longrightarrow> P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Ya. ltl (lSup (fst ` Y)) = lSup (fst ` Ya) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Ya) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Ya \<and> (\<forall>(x, y)\<in>Ya. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))
(\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y)))
(\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y)))

goal (1 subgoal):
 1. P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
P (lhd (lSup (fst ` Y))) (lhd (lSup (snd ` Y))) \<and> ((\<exists>Y. ltl (lSup (fst ` Y)) = lSup (fst ` Y) \<and> ltl (lSup (snd ` Y)) = lSup (snd ` Y) \<and> Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) Y \<and> (\<forall>(x, y)\<in>Y. llist_all2 P x y)) \<or> llist_all2 P (ltl (lSup (fst ` Y))) (ltl (lSup (snd ` Y))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diagonal_to_Smith_aux_PQ:
  assumes P'B'Q': "(P',B',Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P,B,Q)"
  and diag: "isDiagonal B" and k:"k<min (nrows A) (ncols A)"
shows "B' = P'**A**Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout
[PROOF STEP]
using k P'B'Q' P Q PAQ diag
[PROOF STATE]
proof (prove)
using this:
k < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B

goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout
[PROOF STEP]
proof (induct k arbitrary: P B Q P' Q' B')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P B Q P' Q' B'. \<lbrakk>0 < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<0] bezout
 2. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B

goal (2 subgoals):
 1. \<And>P B Q P' Q' B'. \<lbrakk>0 < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<0] bezout
 2. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B

goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<0] bezout
[PROOF STEP]
using P Q PAQ
[PROOF STATE]
proof (prove)
using this:
0 < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<0] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B
invertible P
invertible Q
P ** A ** Q = B

goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<0] bezout
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<0] bezout

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
case (Suc k P B Q P' Q' B')
[PROOF STATE]
proof (state)
this:
\<lbrakk>k < min (nrows A) (ncols A); (?P', ?B', ?Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (?P, ?B, ?Q); invertible ?P; invertible ?Q; ?P ** A ** ?Q = ?B; isDiagonal ?B\<rbrakk> \<Longrightarrow> ?B' = ?P' ** A ** ?Q' \<and> invertible ?P' \<and> invertible ?Q' \<and> ?B' = diagonal_to_Smith_aux ?B [0..<k] bezout
Suc k < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note Suc_k = Suc.prems(1)
[PROOF STATE]
proof (state)
this:
Suc k < min (nrows A) (ncols A)

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note PBQ = Suc.prems(2)
[PROOF STATE]
proof (state)
this:
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q)

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note P = Suc.prems(3)
[PROOF STATE]
proof (state)
this:
invertible P

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note Q = Suc.prems(4)
[PROOF STATE]
proof (state)
this:
invertible Q

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note PAQ_B = Suc.prems(5)
[PROOF STATE]
proof (state)
this:
P ** A ** Q = B

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
note diag_B = Suc.prems(6)
[PROOF STATE]
proof (state)
this:
isDiagonal B

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
let ?Dk = "(diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
let ?P' = "fst ?Dk"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
let ?B'="fst (snd ?Dk)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
let ?Q' = "snd (snd ?Dk)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
have k: "k<min (nrows A) (ncols A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < min (nrows A) (ncols A)
[PROOF STEP]
using Suc_k
[PROOF STATE]
proof (prove)
using this:
Suc k < min (nrows A) (ncols A)

goal (1 subgoal):
 1. k < min (nrows A) (ncols A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k < min (nrows A) (ncols A)

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
have hyp: "?B' = ?P' ** A ** ?Q' \<and> invertible ?P' \<and> invertible ?Q'
      \<and> ?B' = diagonal_to_Smith_aux B [0..<k] bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))) \<and> fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = diagonal_to_Smith_aux B [0..<k] bezout
[PROOF STEP]
by (rule Suc.hyps[OF k _ P Q PAQ_B diag_B], auto simp add: PAQ_B)
[PROOF STATE]
proof (state)
this:
fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))) \<and> fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = diagonal_to_Smith_aux B [0..<k] bezout

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
have diag_B': "isDiagonal ?B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
by (metis diag_B hyp ib isDiagonal_diagonal_to_Smith_aux k ncols_def nrows_def)
[PROOF STATE]
proof (state)
this:
isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
have "B' = diagonal_to_Smith_aux B [0..<Suc k] bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
by (auto, metis Diagonal_to_Smith_row_i_PQ_eq PAQ_B Suc(3) diag_B'
        diagonal_to_Smith_aux_PQ_append2 eq_fst_iff hyp ib k sndI upt.simps(2) zero_order(1))
[PROOF STATE]
proof (state)
this:
B' = diagonal_to_Smith_aux B [0..<Suc k] bezout

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
B' = diagonal_to_Smith_aux B [0..<Suc k] bezout

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
have "B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q'
[PROOF STEP]
proof (rule Diagonal_to_Smith_row_i_PQ')
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. ?P ** A ** ?Q = ?B
 2. invertible ?P
 3. invertible ?Q
 4. is_bezout_ext ?bezout
 5. (P', B', Q') = Diagonal_to_Smith_row_i_PQ ?i ?bezout (?P, ?B, ?Q)
 6. isDiagonal ?B
 7. ?i < min (nrows A) (ncols A)
[PROOF STEP]
show "(P', B', Q') = Diagonal_to_Smith_row_i_PQ k bezout (?P',?B',?Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P', B', Q') = Diagonal_to_Smith_row_i_PQ k bezout (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)), fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))), snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc k < min (nrows A) (ncols A)
(P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q)
invertible P
invertible Q
P ** A ** Q = B
isDiagonal B

goal (1 subgoal):
 1. (P', B', Q') = Diagonal_to_Smith_row_i_PQ k bezout (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)), fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))), snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(P', B', Q') = Diagonal_to_Smith_row_i_PQ k bezout (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)), fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))), snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))

goal (6 subgoals):
 1. fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
 2. invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
 3. invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 4. is_bezout_ext bezout
 5. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 6. k < min (nrows A) (ncols A)
[PROOF STEP]
show "invertible ?P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))) \<and> fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = diagonal_to_Smith_aux B [0..<k] bezout

goal (1 subgoal):
 1. invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))

goal (5 subgoals):
 1. fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
 2. invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 3. is_bezout_ext bezout
 4. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 5. k < min (nrows A) (ncols A)
[PROOF STEP]
show "?P' ** A ** ?Q' = ?B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))) \<and> fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = diagonal_to_Smith_aux B [0..<k] bezout

goal (1 subgoal):
 1. fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))

goal (4 subgoals):
 1. invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 2. is_bezout_ext bezout
 3. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 4. k < min (nrows A) (ncols A)
[PROOF STEP]
show "invertible ?Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)) ** A ** snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (fst (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) \<and> invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q)))) \<and> fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))) = diagonal_to_Smith_aux B [0..<k] bezout

goal (1 subgoal):
 1. invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible (snd (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))

goal (3 subgoals):
 1. is_bezout_ext bezout
 2. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 3. k < min (nrows A) (ncols A)
[PROOF STEP]
show "is_bezout_ext bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_bezout_ext bezout
[PROOF STEP]
using ib
[PROOF STATE]
proof (prove)
using this:
is_bezout_ext bezout

goal (1 subgoal):
 1. is_bezout_ext bezout
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_bezout_ext bezout

goal (2 subgoals):
 1. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
 2. k < min (nrows A) (ncols A)
[PROOF STEP]
show "k < min (nrows A) (ncols A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < min (nrows A) (ncols A)
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k < min (nrows A) (ncols A)

goal (1 subgoal):
 1. k < min (nrows A) (ncols A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k < min (nrows A) (ncols A)

goal (1 subgoal):
 1. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
show diag_B': "isDiagonal ?B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
using diag_B'
[PROOF STATE]
proof (prove)
using this:
isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))

goal (1 subgoal):
 1. isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isDiagonal (fst (snd (diagonal_to_Smith_aux_PQ [0..<k] bezout (P, P ** A ** Q, Q))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q'

goal (1 subgoal):
 1. \<And>k P B Q P' Q' B'. \<lbrakk>\<And>P B Q P' Q' B'. \<lbrakk>k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<k] bezout; Suc k < min (nrows A) (ncols A); (P', B', Q') = diagonal_to_Smith_aux_PQ [0..<Suc k] bezout (P, B, Q); invertible P; invertible Q; P ** A ** Q = B; isDiagonal B\<rbrakk> \<Longrightarrow> B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q'

goal (1 subgoal):
 1. B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B' = P' ** A ** Q' \<and> invertible P' \<and> invertible Q' \<and> B' = diagonal_to_Smith_aux B [0..<Suc k] bezout

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powreal_gt_one: "a > 1 \<Longrightarrow> x > 0 \<Longrightarrow> a pow\<^sub>\<real> x > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> 1 < a pow\<^sub>\<real> x
[PROOF STEP]
by (metis less_eq_real_def powa_less_mono powa_zero_eq_one powreal_eq_powa)


[STATEMENT]
lemma drae_image_dra_drae: "drae_image f (dra_drae A) = drae
    (alphabet A) (f (initial A))
    (\<Union> p \<in> nodes A. \<Union> a \<in> alphabet A. f ` {p} \<times> {a} \<times> f ` {transition A a p})
    (map (\<lambda> (P, Q). (f ` {p \<in> nodes A. P p}, f ` {p \<in> nodes A. Q p})) (condition A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drae_image f (dra_drae A) = drae (alphabet A) (f (initial A)) (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` {transition A a p}) (map (\<lambda>(P, Q). (f ` {p \<in> nodes A. P p}, f ` {p \<in> nodes A. Q p})) (condition A))
[PROOF STEP]
unfolding dra_drae_def drae_image_def drae.simps Set.filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alphabete (drae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) (map (\<lambda>(P, Q). ({a \<in> nodes A. P a}, {a \<in> nodes A. Q a})) (condition A))) = alphabet A \<and> f (initiale (drae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) (map (\<lambda>(P, Q). ({a \<in> nodes A. P a}, {a \<in> nodes A. Q a})) (condition A)))) = f (initial A) \<and> (\<lambda>(p, a, q). (f p, a, f q)) ` transitione (drae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) (map (\<lambda>(P, Q). ({a \<in> nodes A. P a}, {a \<in> nodes A. Q a})) (condition A))) = (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` {transition A a p}) \<and> map (map_prod ((`) f) ((`) f)) (conditione (drae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) (map (\<lambda>(P, Q). ({a \<in> nodes A. P a}, {a \<in> nodes A. Q a})) (condition A)))) = map (\<lambda>(P, Q). (f ` {p \<in> nodes A. P p}, f ` {p \<in> nodes A. Q p})) (condition A)
[PROOF STEP]
by force


[STATEMENT]
lemma conway_monoid_identity:
  assumes "conway_assm1 x" "conway_assm2 x"
  shows "(\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV})\<^sup>\<star> = (\<Sum> {x\<^bsub>i\<^esub>| i. i\<in>UNIV})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
have one:"(\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}) \<cdot> (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}) = (1 + (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV})) \<cdot> (1 + (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV})
[PROOF STEP]
by (metis (mono_tags) assms(2) conway_monoid_split)
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV})

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV})

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
have "... = 1 + (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}) + ((\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}) \<cdot> (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
by (metis (lifting, no_types) calculation less_eq_def mult_isol mult_isol_equiv_subdistl mult_oner)
[PROOF STATE]
proof (state)
this:
((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) \<cdot> ((1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}) = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
have "... = 1 + (\<Sum> {x\<^bsub>i\<^esub>|i. i\<in>UNIV}) + (\<Sum> {x\<^bsub>i \<^esub>\<cdot> x\<^bsub>j\<^esub> | i j. i\<in>UNIV \<and> j\<in>UNIV})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
by (simp only: dioid_sum_prod finite_UNIV)
[PROOF STATE]
proof (state)
this:
(1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
have "\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
apply (simp only:)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} \<Longrightarrow> (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} \<Longrightarrow> (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
assume a1: "\<Sum>{x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum>{x\<^bsub>i\<^esub> |i. i \<in> UNIV} = 1 + \<Sum>{x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum>{x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}"
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} \<Longrightarrow> (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
hence "\<Sum>{x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum>{x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum>{x\<^bsub>R\<^esub> |R. R \<in> UNIV}"
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV}
[PROOF STEP]
using assms(1) assms(2) boffa_aux3 conway_monoid_split
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}
conway_assm1 x
conway_assm2 x
conway_assm1 ?x \<Longrightarrow> \<Sum> {?x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {?x\<^bsub>i\<^esub> \<cdot> ?x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {?x\<^bsub>i\<^esub> |i. i \<in> UNIV}
conway_assm2 ?x \<Longrightarrow> \<Sum> {?x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::?'b) + \<Sum> {?x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} \<Longrightarrow> (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
thus "1 + \<Sum>{x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum>{x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum>{x\<^bsub>i\<^esub> |i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV}

goal (1 subgoal):
 1. (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV} = \<Sum> {x\<^bsub>R\<^esub> |R. R \<in> UNIV}
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (1 subgoal):
 1. (1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'b) + \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} + \<Sum> {x\<^bsub>i\<^esub> \<cdot> x\<^bsub>j\<^esub> |i j. i \<in> UNIV \<and> j \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} \<cdot> \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV} = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}
[PROOF STEP]
by (metis (mono_tags) one B1_algebra_class.R star_trans_eq)
[PROOF STATE]
proof (state)
this:
\<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}\<^sup>\<star> = \<Sum> {x\<^bsub>i\<^esub> |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma maximal_repetition_sets_from_separators_code[code]:
  "maximal_repetition_sets_from_separators M = (let DR = (image fst (d_reachable_states_with_preambles M))
    in  image (\<lambda> S . (S, S \<inter> DR)) (maximal_pairwise_r_distinguishable_state_sets_from_separators M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. maximal_repetition_sets_from_separators M = (let DR = fst ` d_reachable_states_with_preambles M in (\<lambda>S. (S, S \<inter> DR)) ` maximal_pairwise_r_distinguishable_state_sets_from_separators M)
[PROOF STEP]
unfolding maximal_repetition_sets_from_separators_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(S, S \<inter> fst ` d_reachable_states_with_preambles M) |S. S \<in> maximal_pairwise_r_distinguishable_state_sets_from_separators M} = (\<lambda>S. (S, S \<inter> fst ` d_reachable_states_with_preambles M)) ` maximal_pairwise_r_distinguishable_state_sets_from_separators M
[PROOF STEP]
by force


[STATEMENT]
lemma remdups_fwd_split_exact_iff:
  "remdups_fwd_acc Acc xs = ys @ x # zs \<longleftrightarrow>
    (\<exists>us vs. xs = us @ x # vs \<and> x \<notin> Acc \<and> x \<notin> set us \<and> remdups_fwd_acc Acc us = ys \<and> remdups_fwd_acc (Acc \<union> set ys \<union> {x}) vs = zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (remdups_fwd_acc Acc xs = ys @ x # zs) = (\<exists>us vs. xs = us @ x # vs \<and> x \<notin> Acc \<and> x \<notin> set us \<and> remdups_fwd_acc Acc us = ys \<and> remdups_fwd_acc (Acc \<union> set ys \<union> {x}) vs = zs)
[PROOF STEP]
using remdups_fwd_split_exact
[PROOF STATE]
proof (prove)
using this:
remdups_fwd_acc ?Acc ?xs = ?ys @ ?x # ?zs \<Longrightarrow> \<exists>us vs. ?xs = us @ ?x # vs \<and> ?x \<notin> ?Acc \<and> ?x \<notin> set ?ys \<and> remdups_fwd_acc ?Acc us = ?ys \<and> remdups_fwd_acc (?Acc \<union> set ?ys \<union> {?x}) vs = ?zs

goal (1 subgoal):
 1. (remdups_fwd_acc Acc xs = ys @ x # zs) = (\<exists>us vs. xs = us @ x # vs \<and> x \<notin> Acc \<and> x \<notin> set us \<and> remdups_fwd_acc Acc us = ys \<and> remdups_fwd_acc (Acc \<union> set ys \<union> {x}) vs = zs)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma "((P = Q) = R) = (P = (Q = R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P = Q) = R) = (P = (Q = R))
[PROOF STEP]
by blast


[STATEMENT]
lemma bigtheta_powr:
  fixes f :: "'a \<Rightarrow> real"
  shows "f \<in> \<Theta>[F](g) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<Theta>[F](g) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
apply (cases "p < 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> \<Theta>[F](g); p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)
 2. \<lbrakk>f \<in> \<Theta>[F](g); \<not> p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
apply (subst bigtheta_inverse[symmetric], subst (1 2) powr_minus[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> \<Theta>[F](g); p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr - p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr - p)
 2. \<lbrakk>f \<in> \<Theta>[F](g); \<not> p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
unfolding bigtheta_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> O[F](g) \<inter> \<Omega>[F](g); p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr - p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr - p) \<inter> \<Omega>[F](\<lambda>x. \<bar>g x\<bar> powr - p)
 2. \<lbrakk>f \<in> O[F](g) \<inter> \<Omega>[F](g); \<not> p < 0\<rbrakk> \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p) \<inter> \<Omega>[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
apply (auto simp: bigomega_iff_bigo intro!: bigo_powr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma equiintegrable_on_null [simp]:
   "content(cbox a b) = 0 \<Longrightarrow> F equiintegrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox a b) = 0 \<Longrightarrow> F equiintegrable_on cbox a b
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox a b) = 0 \<Longrightarrow> (\<forall>f\<in>F. f integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<and> \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral (cbox a b) f) < e))
[PROOF STEP]
by (metis diff_zero gauge_trivial integrable_on_null integral_null norm_zero sum_content_null)