[STATEMENT]
theorem general_order_extension_iff_consistent:
  assumes "\<And>x y. \<lbrakk> x \<in> S; y \<in> S; x \<noteq> y \<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>+"
  assumes "total_preorder_on S Ord"
  shows "(\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord)
     \<longleftrightarrow> consistent Q" (is "?ExExt \<longleftrightarrow> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord) = consistent Q
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord \<Longrightarrow> consistent Q
 2. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
assume "?ExExt"
[PROOF STATE]
proof (state)
this:
\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord

goal (2 subgoals):
 1. \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord \<Longrightarrow> consistent Q
 2. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
obtain Ext where
    "extends Ext Q"
    "refl Ext" "trans Ext" "total Ext"
    "Restr Ext S = Restr Ord S"
[PROOF STATE]
proof (prove)
using this:
\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord

goal (1 subgoal):
 1. (\<And>Ext. \<lbrakk>extends Ext Q; refl Ext; trans Ext; total Ext; Restr Ext S = Restr Ord S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using total_preorder_onD
[PROOF STATE]
proof (prove)
using this:
\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
total_preorder_on ?A ?r \<Longrightarrow> refl_on ?A ?r
total_preorder_on ?A ?r \<Longrightarrow> trans ?r
total_preorder_on ?A ?r \<Longrightarrow> total_on ?A ?r

goal (1 subgoal):
 1. (\<And>Ext. \<lbrakk>extends Ext Q; refl Ext; trans Ext; total Ext; Restr Ext S = Restr Ord S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
extends Ext Q
refl Ext
trans Ext
total Ext
Restr Ext S = Restr Ord S

goal (2 subgoals):
 1. \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord \<Longrightarrow> consistent Q
 2. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
show "consistent Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistent Q
[PROOF STEP]
proof(rule consistentI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<notin> asym_factor Q
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<notin> asym_factor Q
[PROOF STEP]
assume "(x, y) \<in> Q\<^sup>+"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> Q\<^sup>+

goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<notin> asym_factor Q
[PROOF STEP]
with \<open>extends Ext Q\<close> \<open>trans Ext\<close>
[PROOF STATE]
proof (chain)
picking this:
extends Ext Q
trans Ext
(x, y) \<in> Q\<^sup>+
[PROOF STEP]
have "(x, y) \<in> Ext"
[PROOF STATE]
proof (prove)
using this:
extends Ext Q
trans Ext
(x, y) \<in> Q\<^sup>+

goal (1 subgoal):
 1. (x, y) \<in> Ext
[PROOF STEP]
unfolding extends_def
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Ext \<and> asym_factor Q \<subseteq> asym_factor Ext
trans Ext
(x, y) \<in> Q\<^sup>+

goal (1 subgoal):
 1. (x, y) \<in> Ext
[PROOF STEP]
by (metis trancl_id trancl_mono)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> Ext

goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<notin> asym_factor Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> Ext
[PROOF STEP]
have "(y, x) \<notin> asym_factor Ext"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> Ext

goal (1 subgoal):
 1. (y, x) \<notin> asym_factor Ext
[PROOF STEP]
unfolding asym_factor_def
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> Ext

goal (1 subgoal):
 1. (y, x) \<notin> {(x, y). (x, y) \<in> Ext \<and> (y, x) \<notin> Ext}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(y, x) \<notin> asym_factor Ext

goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<notin> asym_factor Q
[PROOF STEP]
with \<open>extends Ext Q\<close>
[PROOF STATE]
proof (chain)
picking this:
extends Ext Q
(y, x) \<notin> asym_factor Ext
[PROOF STEP]
show "(y, x) \<notin> asym_factor Q"
[PROOF STATE]
proof (prove)
using this:
extends Ext Q
(y, x) \<notin> asym_factor Ext

goal (1 subgoal):
 1. (y, x) \<notin> asym_factor Q
[PROOF STEP]
unfolding extends_def asym_factor_def
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Ext \<and> {(x, y). (x, y) \<in> Q \<and> (y, x) \<notin> Q} \<subseteq> {(x, y). (x, y) \<in> Ext \<and> (y, x) \<notin> Ext}
(y, x) \<notin> {(x, y). (x, y) \<in> Ext \<and> (y, x) \<notin> Ext}

goal (1 subgoal):
 1. (y, x) \<notin> {(x, y). (x, y) \<in> Q \<and> (y, x) \<notin> Q}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(y, x) \<notin> asym_factor Q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
consistent Q

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
assume "consistent Q"
[PROOF STATE]
proof (state)
this:
consistent Q

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
define Q' where "Q' \<equiv> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*"
[PROOF STATE]
proof (state)
this:
Q' \<equiv> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have "refl (Q\<^sup>*)" "trans (Q\<^sup>*)" "refl_on S Ord" "trans Ord" "total_on S Ord"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (refl (Q\<^sup>*) &&& trans (Q\<^sup>*)) &&& refl_on S Ord &&& trans Ord &&& total_on S Ord
[PROOF STEP]
using refl_rtrancl trans_rtrancl total_preorder_onD[OF \<open>total_preorder_on S Ord\<close>]
[PROOF STATE]
proof (prove)
using this:
refl (?r\<^sup>*)
trans (?r\<^sup>*)
refl_on S Ord
trans Ord
total_on S Ord

goal (1 subgoal):
 1. (refl (Q\<^sup>*) &&& trans (Q\<^sup>*)) &&& refl_on S Ord &&& trans Ord &&& total_on S Ord
[PROOF STEP]
by - assumption
[PROOF STATE]
proof (state)
this:
refl (Q\<^sup>*)
trans (Q\<^sup>*)
refl_on S Ord
trans Ord
total_on S Ord

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have preorder_Q': "preorder Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. preorder Q'
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. refl Q'
 2. trans Q'
[PROOF STEP]
show "refl Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl Q'
[PROOF STEP]
unfolding Q'_def refl_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>* \<subseteq> UNIV \<times> UNIV \<and> (\<forall>x\<in>UNIV. (x, x) \<in> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
refl Q'

goal (1 subgoal):
 1. trans Q'
[PROOF STEP]
from \<open>trans (Q\<^sup>*)\<close> \<open>refl_on S Ord\<close> \<open>trans Ord\<close>
[PROOF STATE]
proof (chain)
picking this:
trans (Q\<^sup>*)
refl_on S Ord
trans Ord
[PROOF STEP]
show "trans Q'"
[PROOF STATE]
proof (prove)
using this:
trans (Q\<^sup>*)
refl_on S Ord
trans Ord

goal (1 subgoal):
 1. trans Q'
[PROOF STEP]
unfolding Q'_def[simplified]
[PROOF STATE]
proof (prove)
using this:
trans (Q\<^sup>*)
refl_on S Ord
trans Ord

goal (1 subgoal):
 1. trans (Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*)
[PROOF STEP]
apply(safe intro!: transI)
[PROOF STATE]
proof (prove)
goal (25 subgoals):
 1. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, z) \<notin> Q\<^sup>* O Ord; (x, z) \<notin> Ord O Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 2. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, z) \<notin> Q\<^sup>* O Ord; (x, z) \<notin> Ord O Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 3. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, z) \<notin> Q\<^sup>* O Ord; (x, z) \<notin> Ord O Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Ord; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 4. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, z) \<notin> Q\<^sup>* O Ord; (x, z) \<notin> Ord O Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Ord; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 5. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, za) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, za) \<notin> Q\<^sup>* O Ord; (x, za) \<notin> Ord O Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (x, xa) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
 6. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, za) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, za) \<notin> Q\<^sup>* O Ord; (x, za) \<notin> Ord O Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (x, xa) \<in> Ord\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
 7. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (xa, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (xa, z) \<notin> Q\<^sup>* O Ord; (xa, z) \<notin> Ord O Q\<^sup>*; (xa, z) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (za, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (xa, z) \<in> Q\<^sup>*
 8. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (xa, z) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (xa, z) \<notin> Q\<^sup>* O Ord; (xa, z) \<notin> Ord O Q\<^sup>*; (xa, z) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (za, z) \<in> Ord\<rbrakk> \<Longrightarrow> (xa, z) \<in> Q\<^sup>*
 9. \<And>x y z xa ya za xb yb zb. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (xa, zb) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (xa, zb) \<notin> Q\<^sup>* O Ord; (xa, zb) \<notin> Ord O Q\<^sup>*; (xa, zb) \<notin> Ord; (xa, ya) \<in> Ord; (ya, xb) \<in> Q\<^sup>*; (xb, yb) \<in> Ord; (yb, zb) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (xa, zb) \<in> Q\<^sup>*
 10. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; (x, za) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (x, za) \<notin> Q\<^sup>* O Ord; (x, za) \<notin> Ord O Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Q\<^sup>*; (ya, za) \<in> Ord; (x, xa) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
A total of 25 subgoals...
[PROOF STEP]
unfolding relcomp.simps
[PROOF STATE]
proof (prove)
goal (25 subgoals):
 1. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 2. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 3. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Ord; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 4. \<And>x y z. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, z) \<notin> Ord; (x, y) \<in> Ord; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> (x, z) \<in> Q\<^sup>*
 5. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> za = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (x, xa) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
 6. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> za = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (x, xa) \<in> Ord\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
 7. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. xa = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. xa = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. xa = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (xa, z) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (za, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (xa, z) \<in> Q\<^sup>*
 8. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. xa = a \<and> z = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. xa = a \<and> z = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. xa = a \<and> z = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (xa, z) \<notin> Ord; (xa, ya) \<in> Ord; (ya, za) \<in> Q\<^sup>*; (za, z) \<in> Ord\<rbrakk> \<Longrightarrow> (xa, z) \<in> Q\<^sup>*
 9. \<And>x y z xa ya za xb yb zb. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. xa = a \<and> zb = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. xa = a \<and> zb = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. xa = a \<and> zb = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (xa, zb) \<notin> Ord; (xa, ya) \<in> Ord; (ya, xb) \<in> Q\<^sup>*; (xb, yb) \<in> Ord; (yb, zb) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (xa, zb) \<in> Q\<^sup>*
 10. \<And>x y z xa ya za. \<lbrakk>trans (Q\<^sup>*); refl_on S Ord; trans Ord; \<nexists>a b c. x = a \<and> za = c \<and> (\<exists>aa ba c. a = aa \<and> b = c \<and> (aa, ba) \<in> Q\<^sup>* \<and> (ba, c) \<in> Ord) \<and> (b, c) \<in> Q\<^sup>*; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Q\<^sup>* \<and> (b, c) \<in> Ord; \<nexists>a b c. x = a \<and> za = c \<and> (a, b) \<in> Ord \<and> (b, c) \<in> Q\<^sup>*; (x, za) \<notin> Ord; (xa, ya) \<in> Q\<^sup>*; (ya, za) \<in> Ord; (x, xa) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> (x, za) \<in> Q\<^sup>*
A total of 25 subgoals...
[PROOF STEP]
by (metis assms(1) refl_on_domain rtranclD transD)+
[PROOF STATE]
proof (state)
this:
trans Q'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
preorder Q'

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have "consistent Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistent Q'
[PROOF STEP]
using consistent_if_preorder_on preorder_Q'
[PROOF STATE]
proof (prove)
using this:
preorder_on ?A ?r \<Longrightarrow> consistent ?r
preorder Q'

goal (1 subgoal):
 1. consistent Q'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
consistent Q'

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have "extends Q' Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extends Q' Q
[PROOF STEP]
proof(rule extendsI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Q \<subseteq> Q'
 2. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
have "Q \<subseteq> Restr (Q\<^sup>*) (Field Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<subseteq> Restr (Q\<^sup>*) (Field Q)
[PROOF STEP]
by (auto intro: FieldI1 FieldI2)
[PROOF STATE]
proof (state)
this:
Q \<subseteq> Restr (Q\<^sup>*) (Field Q)

goal (2 subgoals):
 1. Q \<subseteq> Q'
 2. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<subseteq> Restr (Q\<^sup>*) (Field Q)
[PROOF STEP]
show "Q \<subseteq> Q'"
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Restr (Q\<^sup>*) (Field Q)

goal (1 subgoal):
 1. Q \<subseteq> Q'
[PROOF STEP]
unfolding Q'_def
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Restr (Q\<^sup>*) (Field Q)

goal (1 subgoal):
 1. Q \<subseteq> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Q \<subseteq> Q'

goal (1 subgoal):
 1. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
from \<open>consistent Q\<close>
[PROOF STATE]
proof (chain)
picking this:
consistent Q
[PROOF STEP]
have consistentD: "(x, y) \<in> Q\<^sup>+ \<Longrightarrow> (y, x) \<in> Q \<Longrightarrow> (x, y) \<in> Q" for x y
[PROOF STATE]
proof (prove)
using this:
consistent Q

goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> Q\<^sup>+; (y, x) \<in> Q\<rbrakk> \<Longrightarrow> (x, y) \<in> Q
[PROOF STEP]
unfolding consistent_def asym_factor_def
[PROOF STATE]
proof (prove)
using this:
\<forall>(x, y)\<in>Q\<^sup>+. (y, x) \<notin> {(x, y). (x, y) \<in> Q \<and> (y, x) \<notin> Q}

goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> Q\<^sup>+; (y, x) \<in> Q\<rbrakk> \<Longrightarrow> (x, y) \<in> Q
[PROOF STEP]
using rtranclD
[PROOF STATE]
proof (prove)
using this:
\<forall>(x, y)\<in>Q\<^sup>+. (y, x) \<notin> {(x, y). (x, y) \<in> Q \<and> (y, x) \<notin> Q}
(?a, ?b) \<in> ?R\<^sup>* \<Longrightarrow> ?a = ?b \<or> ?a \<noteq> ?b \<and> (?a, ?b) \<in> ?R\<^sup>+

goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> Q\<^sup>+; (y, x) \<in> Q\<rbrakk> \<Longrightarrow> (x, y) \<in> Q
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x, ?y) \<in> Q\<^sup>+; (?y, ?x) \<in> Q\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> Q

goal (1 subgoal):
 1. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
have refl_on_domainE: "\<lbrakk> (x, y) \<in> Ord; x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P" for x y P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> Ord; \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
using refl_on_domain[OF \<open>refl_on S Ord\<close>]
[PROOF STATE]
proof (prove)
using this:
(?a, ?b) \<in> Ord \<Longrightarrow> ?a \<in> S \<and> ?b \<in> S

goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> Ord; \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x, ?y) \<in> Ord; \<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
show "asym_factor Q \<subseteq> asym_factor Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asym_factor Q \<subseteq> asym_factor Q'
[PROOF STEP]
unfolding Q'_def asym_factor_def Field_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). (x, y) \<in> Q \<and> (y, x) \<notin> Q} \<subseteq> {(x, y). (x, y) \<in> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>* \<and> (y, x) \<notin> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*}
[PROOF STEP]
apply(safe)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (a, b) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (a, b) \<notin> Q\<^sup>* O Ord; (a, b) \<notin> Ord O Q\<^sup>*; (a, b) \<notin> Ord\<rbrakk> \<Longrightarrow> (a, b) \<in> Q\<^sup>*
 2. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (b, a) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 3. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (b, a) \<in> Ord\<rbrakk> \<Longrightarrow> False
 4. \<And>a b x y z. \<lbrakk>(z, x) \<in> Q; (x, z) \<notin> Q; (x, y) \<in> Ord; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 5. \<And>a b x y z. \<lbrakk>(z, x) \<in> Q; (x, z) \<notin> Q; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> False
 6. \<And>a b x y z xa ya za. \<lbrakk>(z, xa) \<in> Q; (xa, z) \<notin> Q; (za, z) \<in> Q\<^sup>*; (xa, ya) \<in> Q\<^sup>*; (ya, za) \<in> Ord\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms(1) consistentD refl_on_domainE
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q\<^sup>+
\<lbrakk>(?x, ?y) \<in> Q\<^sup>+; (?y, ?x) \<in> Q\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> Q
\<lbrakk>(?x, ?y) \<in> Ord; \<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (6 subgoals):
 1. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (a, b) \<notin> (Q\<^sup>* O Ord) O Q\<^sup>*; (a, b) \<notin> Q\<^sup>* O Ord; (a, b) \<notin> Ord O Q\<^sup>*; (a, b) \<notin> Ord\<rbrakk> \<Longrightarrow> (a, b) \<in> Q\<^sup>*
 2. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (b, a) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 3. \<And>a b. \<lbrakk>(a, b) \<in> Q; (b, a) \<notin> Q; (b, a) \<in> Ord\<rbrakk> \<Longrightarrow> False
 4. \<And>a b x y z. \<lbrakk>(z, x) \<in> Q; (x, z) \<notin> Q; (x, y) \<in> Ord; (y, z) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 5. \<And>a b x y z. \<lbrakk>(z, x) \<in> Q; (x, z) \<notin> Q; (x, y) \<in> Q\<^sup>*; (y, z) \<in> Ord\<rbrakk> \<Longrightarrow> False
 6. \<And>a b x y z xa ya za. \<lbrakk>(z, xa) \<in> Q; (xa, z) \<notin> Q; (za, z) \<in> Q\<^sup>*; (xa, ya) \<in> Q\<^sup>*; (ya, za) \<in> Ord\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis r_into_rtrancl rtranclD rtrancl_trancl_trancl)+
[PROOF STATE]
proof (state)
this:
asym_factor Q \<subseteq> asym_factor Q'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
extends Q' Q

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
with strict_extends_preorder_on[OF \<open>preorder Q'\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<exists>r. total_preorder r \<and> strict_extends r Q'
extends Q' Q
[PROOF STEP]
obtain Ext where Ext: "extends Ext Q'" "extends Ext Q" "total_preorder Ext"
[PROOF STATE]
proof (prove)
using this:
\<exists>r. total_preorder r \<and> strict_extends r Q'
extends Q' Q

goal (1 subgoal):
 1. (\<And>Ext. \<lbrakk>extends Ext Q'; extends Ext Q; total_preorder Ext\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding strict_extends_def
[PROOF STATE]
proof (prove)
using this:
\<exists>r. total_preorder r \<and> extends r Q' \<and> sym_factor r \<subseteq> (sym_factor Q')\<^sup>=
extends Q' Q

goal (1 subgoal):
 1. (\<And>Ext. \<lbrakk>extends Ext Q'; extends Ext Q; total_preorder Ext\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis transpE transp_extends)
[PROOF STATE]
proof (state)
this:
extends Ext Q'
extends Ext Q
total_preorder Ext

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have not_in_Q': "x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> (x, y) \<notin> Ord \<Longrightarrow> (x, y) \<notin> Q'" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q'
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q\<^sup>+

goal (1 subgoal):
 1. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q'
[PROOF STEP]
unfolding Q'_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q\<^sup>+

goal (1 subgoal):
 1. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*
[PROOF STEP]
apply(safe)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord; \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x \<noteq> y\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>+; (x, y) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 2. \<And>xa ya z. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord; \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x \<noteq> y\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>+; (x, ya) \<in> Ord; (ya, y) \<in> Q\<^sup>*\<rbrakk> \<Longrightarrow> False
 3. \<And>xa ya z. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord; \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x \<noteq> y\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>+; (x, ya) \<in> Q\<^sup>*; (ya, y) \<in> Ord\<rbrakk> \<Longrightarrow> False
 4. \<And>xa ya z xaa yaa za. \<lbrakk>x \<in> S; y \<in> S; (x, y) \<notin> Ord; \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x \<noteq> y\<rbrakk> \<Longrightarrow> (x, y) \<notin> Q\<^sup>+; (za, y) \<in> Q\<^sup>*; (x, yaa) \<in> Q\<^sup>*; (yaa, za) \<in> Ord\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis \<open>refl_on S Ord\<close> refl_on_def refl_on_domain rtranclD)+
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<notin> Ord\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q'

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
have "Restr Ext S = Ord"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Restr Ext S = Ord
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Restr Ext S \<subseteq> Ord
 2. Ord \<subseteq> Restr Ext S
[PROOF STEP]
from \<open>extends Ext Q'\<close>
[PROOF STATE]
proof (chain)
picking this:
extends Ext Q'
[PROOF STEP]
have "Ord \<subseteq> Ext"
[PROOF STATE]
proof (prove)
using this:
extends Ext Q'

goal (1 subgoal):
 1. Ord \<subseteq> Ext
[PROOF STEP]
unfolding Q'_def extends_def
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>* \<subseteq> Ext \<and> asym_factor (Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*) \<subseteq> asym_factor Ext

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

goal (2 subgoals):
 1. Restr Ext S \<subseteq> Ord
 2. Ord \<subseteq> Restr Ext S
[PROOF STEP]
with \<open>refl_on S Ord\<close>
[PROOF STATE]
proof (chain)
picking this:
refl_on S Ord
Ord \<subseteq> Ext
[PROOF STEP]
show "Ord \<subseteq> Restr Ext S"
[PROOF STATE]
proof (prove)
using this:
refl_on S Ord
Ord \<subseteq> Ext

goal (1 subgoal):
 1. Ord \<subseteq> Restr Ext S
[PROOF STEP]
using refl_on_domain
[PROOF STATE]
proof (prove)
using this:
refl_on S Ord
Ord \<subseteq> Ext
\<lbrakk>refl_on ?A ?r; (?a, ?b) \<in> ?r\<rbrakk> \<Longrightarrow> ?a \<in> ?A \<and> ?b \<in> ?A

goal (1 subgoal):
 1. Ord \<subseteq> Restr Ext S
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
Ord \<subseteq> Restr Ext S

goal (1 subgoal):
 1. Restr Ext S \<subseteq> Ord
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Restr Ext S \<subseteq> Ord
[PROOF STEP]
have "(x, y) \<in> Ord" if "x \<in> S" and "y \<in> S" and "(x, y) \<in> Ext" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> Ord
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
assume "(x, y) \<notin> Ord"
[PROOF STATE]
proof (state)
this:
(x, y) \<notin> Ord

goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
with that not_in_Q'
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
y \<in> S
(x, y) \<in> Ext
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<notin> Ord\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q'
(x, y) \<notin> Ord
[PROOF STEP]
have "(x, y) \<notin> Q'"
[PROOF STATE]
proof (prove)
using this:
x \<in> S
y \<in> S
(x, y) \<in> Ext
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<notin> Ord\<rbrakk> \<Longrightarrow> (?x, ?y) \<notin> Q'
(x, y) \<notin> Ord

goal (1 subgoal):
 1. (x, y) \<notin> Q'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(x, y) \<notin> Q'

goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
with \<open>refl_on S Ord\<close> \<open>total_on S Ord\<close> \<open>x \<in> S\<close> \<open>y \<in> S\<close> \<open>(x, y) \<notin> Ord\<close>
[PROOF STATE]
proof (chain)
picking this:
refl_on S Ord
total_on S Ord
x \<in> S
y \<in> S
(x, y) \<notin> Ord
(x, y) \<notin> Q'
[PROOF STEP]
have "(y, x) \<in> Ord"
[PROOF STATE]
proof (prove)
using this:
refl_on S Ord
total_on S Ord
x \<in> S
y \<in> S
(x, y) \<notin> Ord
(x, y) \<notin> Q'

goal (1 subgoal):
 1. (y, x) \<in> Ord
[PROOF STEP]
unfolding refl_on_def total_on_def
[PROOF STATE]
proof (prove)
using this:
Ord \<subseteq> S \<times> S \<and> (\<forall>x\<in>S. (x, x) \<in> Ord)
\<forall>x\<in>S. \<forall>y\<in>S. x \<noteq> y \<longrightarrow> (x, y) \<in> Ord \<or> (y, x) \<in> Ord
x \<in> S
y \<in> S
(x, y) \<notin> Ord
(x, y) \<notin> Q'

goal (1 subgoal):
 1. (y, x) \<in> Ord
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(y, x) \<in> Ord

goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
hence "(y, x) \<in> Q'"
[PROOF STATE]
proof (prove)
using this:
(y, x) \<in> Ord

goal (1 subgoal):
 1. (y, x) \<in> Q'
[PROOF STEP]
unfolding Q'_def
[PROOF STATE]
proof (prove)
using this:
(y, x) \<in> Ord

goal (1 subgoal):
 1. (y, x) \<in> Q\<^sup>* \<union> Ord \<union> Ord O Q\<^sup>* \<union> Q\<^sup>* O Ord \<union> (Q\<^sup>* O Ord) O Q\<^sup>*
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(y, x) \<in> Q'

goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
with \<open>(x, y) \<notin> Q'\<close> \<open>(y, x) \<in> Q'\<close> \<open>extends Ext Q'\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<notin> Q'
(y, x) \<in> Q'
extends Ext Q'
(y, x) \<in> Q'
[PROOF STEP]
have "(x, y) \<notin> Ext"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<notin> Q'
(y, x) \<in> Q'
extends Ext Q'
(y, x) \<in> Q'

goal (1 subgoal):
 1. (x, y) \<notin> Ext
[PROOF STEP]
unfolding extends_def asym_factor_def
[PROOF STATE]
proof (prove)
using this:
(x, y) \<notin> Q'
(y, x) \<in> Q'
Q' \<subseteq> Ext \<and> {(x, y). (x, y) \<in> Q' \<and> (y, x) \<notin> Q'} \<subseteq> {(x, y). (x, y) \<in> Ext \<and> (y, x) \<notin> Ext}
(y, x) \<in> Q'

goal (1 subgoal):
 1. (x, y) \<notin> Ext
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, y) \<notin> Ext

goal (1 subgoal):
 1. (x, y) \<notin> Ord \<Longrightarrow> False
[PROOF STEP]
with \<open>(x, y) \<in> Ext\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> Ext
(x, y) \<notin> Ext
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> Ext
(x, y) \<notin> Ext

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<in> Ext\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> Ord

goal (1 subgoal):
 1. Restr Ext S \<subseteq> Ord
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<in> Ext\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> Ord
[PROOF STEP]
show "Restr Ext S \<subseteq> Ord"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S; (?x, ?y) \<in> Ext\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> Ord

goal (1 subgoal):
 1. Restr Ext S \<subseteq> Ord
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Restr Ext S \<subseteq> Ord

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Restr Ext S = Ord

goal (1 subgoal):
 1. consistent Q \<Longrightarrow> \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
with Ext
[PROOF STATE]
proof (chain)
picking this:
extends Ext Q'
extends Ext Q
total_preorder Ext
Restr Ext S = Ord
[PROOF STEP]
show "?ExExt"
[PROOF STATE]
proof (prove)
using this:
extends Ext Q'
extends Ext Q
total_preorder Ext
Restr Ext S = Ord

goal (1 subgoal):
 1. \<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>Ext. extends Ext Q \<and> total_preorder Ext \<and> Restr Ext S = Ord

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma L_While_set: "L (WHILE b DO c) (set xs) =
  (let f = (\<lambda>Y. vars b \<union> set xs \<union> L c Y)
   in while (\<lambda>Y. f Y \<noteq> Y) f {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (WHILE b DO c) (set xs) = (let f = \<lambda>Y. vars b \<union> set xs \<union> L c Y in while (\<lambda>Y. f Y \<noteq> Y) f {})
[PROOF STEP]
by(rule L_While_let, simp)


[STATEMENT]
lemma Infty_neq_0[simp]:
  "(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> (\<infinity>::ereal)"
  "-(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> -(\<infinity>::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<infinity> \<noteq> 0 &&& 0 \<noteq> \<infinity>) &&& - \<infinity> \<noteq> 0 &&& 0 \<noteq> - \<infinity>
[PROOF STEP]
by (simp_all add: zero_ereal_def)


[STATEMENT]
lemma nonempty_subseteq_mset_eq_singleton: "M \<noteq> {#} \<Longrightarrow> M \<subseteq># {#x#} \<Longrightarrow> M = {#x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<noteq> {#}; M \<subseteq># {#x#}\<rbrakk> \<Longrightarrow> M = {#x#}
[PROOF STEP]
by (cases M) (auto dest: subset_mset.diff_add)


[STATEMENT]
lemma Cinfinite_ctwo_cexp:
  "Cinfinite r \<Longrightarrow> Cinfinite (ctwo ^c r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cinfinite r \<Longrightarrow> Cinfinite (ctwo ^c r)
[PROOF STEP]
unfolding ctwo_def cexp_def cinfinite_def Field_card_of
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (Field r) \<and> Card_order r \<Longrightarrow> infinite (Func (Field r) UNIV) \<and> card_order_on (Func (Field r) UNIV) |Func (Field r) UNIV|
[PROOF STEP]
by (rule conjI, rule infinite_Func, auto)


[STATEMENT]
lemma ccw_scaleR2:
  "det3 0 xr P \<noteq> 0 \<Longrightarrow> 0 < e \<Longrightarrow> ccw 0 xr P \<Longrightarrow> ccw 0 xr (e*\<^sub>RP)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>det3 0 xr P \<noteq> 0; 0 < e; ccw 0 xr P\<rbrakk> \<Longrightarrow> ccw 0 xr (e *\<^sub>R P)
[PROOF STEP]
by (simp add: ccw_def)


[STATEMENT]
theorem Var_inj[simp]:
"(((Var xs x)::('index,'bindex,'varSort,'var,'opSym)term) = Var ys y) =
 (xs = ys \<and> x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Var xs x = Var ys y) = (xs = ys \<and> x = y)
[PROOF STEP]
by (metis alpha_qVar_iff pick_Var_qVar qTerm.inject)


[STATEMENT]
lemma Liminf_const_add:
  fixes c :: "'a::{complete_linorder, linorder_topology, topological_monoid_add, ordered_ab_semigroup_add}"
  shows "F \<noteq> bot \<Longrightarrow> Liminf F (\<lambda>x. c + f x) = c + Liminf F f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<noteq> bot \<Longrightarrow> Liminf F (\<lambda>x. c + f x) = c + Liminf F f
[PROOF STEP]
by (rule Liminf_compose_continuous_mono)
     (auto intro!: monoI add_mono continuous_on_add continuous_on_id continuous_on_const)


[STATEMENT]
lemma special_coset_eq_imp_eq_gensets:
  "\<lbrakk> T1\<in>Pow S; T2\<in>Pow S; w1 +o \<langle>T1\<rangle> = w2 +o \<langle>T2\<rangle> \<rbrakk> \<Longrightarrow> T1=T2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T1 \<in> Pow S; T2 \<in> Pow S; w1 +o \<langle>T1\<rangle> = w2 +o \<langle>T2\<rangle>\<rbrakk> \<Longrightarrow> T1 = T2
[PROOF STEP]
using set_plus_rearrange2[of "-w1" w1 "\<langle>T1\<rangle>"]
        set_plus_rearrange2[of "-w1" w2 "\<langle>T2\<rangle>"]
        genby_lcoset_subgroup_imp_eq_reps[of 0 T1 "-w1+w2" T2]
        inj_onD[OF special_subgroup_inj]
[PROOF STATE]
proof (prove)
using this:
- w1 +o (w1 +o \<langle>T1\<rangle>) = (- w1 + w1) +o \<langle>T1\<rangle>
- w1 +o (w2 +o \<langle>T2\<rangle>) = (- w1 + w2) +o \<langle>T2\<rangle>
(0::'w) +o \<langle>T1\<rangle> \<subseteq> (- w1 + w2) +o \<langle>T2\<rangle> \<Longrightarrow> (- w1 + w2) +o \<langle>T2\<rangle> = (0::'w) +o \<langle>T2\<rangle>
\<lbrakk>\<langle>?x\<rangle> = \<langle>?y\<rangle>; ?x \<in> Pow S; ?y \<in> Pow S\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<lbrakk>T1 \<in> Pow S; T2 \<in> Pow S; w1 +o \<langle>T1\<rangle> = w2 +o \<langle>T2\<rangle>\<rbrakk> \<Longrightarrow> T1 = T2
[PROOF STEP]
by    force


[STATEMENT]
lemma coeff_lift_add : "MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
have "MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m
[PROOF STEP]
apply( simp add : mapping_of_lift_add coeff_def  )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (mapping_of (liftPoly x y a) + mapping_of (liftPoly x y b)) m = lookup (mapping_of (liftPoly x y a + liftPoly x y b)) m
[PROOF STEP]
using lookup_add
[PROOF STATE]
proof (prove)
using this:
lookup (?f + ?g) ?k = lookup ?f ?k + lookup ?g ?k

goal (1 subgoal):
 1. lookup (mapping_of (liftPoly x y a) + mapping_of (liftPoly x y b)) m = lookup (mapping_of (liftPoly x y a + liftPoly x y b)) m
[PROOF STEP]
by (simp add: plus_mpoly.rep_eq)
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m

goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m

goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
have "... = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
using MPolyExtension.coeff_add[of "liftPoly x y a" "liftPoly x y b" m]
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m

goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (liftPoly x y a + liftPoly x y b) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m

goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m

goal (1 subgoal):
 1. MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (liftPoly x y (a + b)) m = MPoly_Type.coeff (liftPoly x y a) m + MPoly_Type.coeff (liftPoly x y b) m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homotopic_with_imp_continuous:
    assumes "homotopic_with_canon P X Y f g"
    shows "continuous_on X f \<and> continuous_on X g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on X f \<and> continuous_on X g
[PROOF STEP]
by (meson assms continuous_map_subtopology_eu homotopic_with_imp_continuous_maps)


[STATEMENT]
lemma indep_implies_non_increasing:
  assumes "indep_interp A"
  shows "non_increasing (applies_eq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_increasing (applies_eq A)
[PROOF STEP]
by (metis (no_types, lifting) applies_eq.simps assms indep_interp_def smaller_interp_def mem_Collect_eq non_increasingI subsetI)


[STATEMENT]
lemma pair_qbs_morphismI:
  assumes "\<And>\<alpha> \<beta>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> \<beta> \<in> qbs_Mx Y
           \<Longrightarrow> f \<circ> (\<lambda>r. (\<alpha> r, \<beta> r)) \<in> qbs_Mx Z"
    shows "f \<in> (X \<Otimes>\<^sub>Q Y) \<rightarrow>\<^sub>Q Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> X \<Otimes>\<^sub>Q Y \<rightarrow>\<^sub>Q Z
[PROOF STEP]
proof(rule qbs_morphismI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
fix \<alpha>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
assume 1:"\<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y)"
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y)

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
have "f \<circ> \<alpha> = f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> \<alpha> = f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<circ> \<alpha> = f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r))

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f \<circ> \<alpha> = f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r))

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
have "... \<in> qbs_Mx Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r)) \<in> qbs_Mx Z
[PROOF STEP]
using 1 assms[of "fst \<circ> \<alpha>" "snd \<circ> \<alpha>"]
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y)
\<lbrakk>fst \<circ> \<alpha> \<in> qbs_Mx X; snd \<circ> \<alpha> \<in> qbs_Mx Y\<rbrakk> \<Longrightarrow> f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r)) \<in> qbs_Mx Z

goal (1 subgoal):
 1. f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r)) \<in> qbs_Mx Z
[PROOF STEP]
by(simp add: pair_qbs_Mx_def)
[PROOF STATE]
proof (state)
this:
f \<circ> (\<lambda>r. ((fst \<circ> \<alpha>) r, (snd \<circ> \<alpha>) r)) \<in> qbs_Mx Z

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx (X \<Otimes>\<^sub>Q Y) \<Longrightarrow> f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
show "f \<circ> \<alpha> \<in> qbs_Mx Z"
[PROOF STATE]
proof (prove)
using this:
f \<circ> \<alpha> \<in> qbs_Mx Z

goal (1 subgoal):
 1. f \<circ> \<alpha> \<in> qbs_Mx Z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f \<circ> \<alpha> \<in> qbs_Mx Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_monom0[simp]: "degree (monom a 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom a 0) = 0
[PROOF STEP]
using degree_monom_le
[PROOF STATE]
proof (prove)
using this:
degree (monom ?a ?n) \<le> ?n

goal (1 subgoal):
 1. degree (monom a 0) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma fiter_seq_choice: "c\<^sup>\<star> = (\<Sqinter>i::nat. c \<^sup>;^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c\<^sup>\<star> = \<Sqinter> range ((\<^sup>;^) c)
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c\<^sup>\<star> \<sqsubseteq> \<Sqinter> range ((\<^sup>;^) c)
 2. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
show "c\<^sup>\<star> \<sqsubseteq> (\<Sqinter>i. c \<^sup>;^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c\<^sup>\<star> \<sqsubseteq> \<Sqinter> range ((\<^sup>;^) c)
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof (rule INF_greatest)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i::nat. i \<in> UNIV \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ i
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i::nat. i \<in> UNIV \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ i
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
show "c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ i
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof (induct i type: nat)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (0::nat)
 2. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (0::nat)
 2. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
show "c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (0::nat)
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp add: fiter0)
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ 0

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (n::nat)

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "c\<^sup>\<star> \<sqsubseteq> c ; c\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c\<^sup>\<star> \<sqsubseteq> c ; c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (metis fiter_unfold inf_le2)
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c ; c\<^sup>\<star>

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c ; c\<^sup>\<star>

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "... \<sqsubseteq> c ; (c \<^sup>;^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c ; c\<^sup>\<star> \<sqsubseteq> c ; (c \<^sup>;^ n)
variables:
n :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (n::nat)

goal (1 subgoal):
 1. c ; c\<^sup>\<star> \<sqsubseteq> c ; (c \<^sup>;^ n)
variables:
n :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp only: seq_mono_right)
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) ; c\<^sup>\<star> \<sqsubseteq> c ; (c \<^sup>;^ (n::nat))

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) ; c\<^sup>\<star> \<sqsubseteq> c ; (c \<^sup>;^ (n::nat))

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "... = c \<^sup>;^ Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c ; (c \<^sup>;^ n) = c \<^sup>;^ Suc n
variables:
n :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) ; (c \<^sup>;^ (n::nat)) = c \<^sup>;^ Suc n

goal (1 subgoal):
 1. \<And>n::nat. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ n \<Longrightarrow> c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc (n::nat)
[PROOF STEP]
show "c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n"
[PROOF STATE]
proof (prove)
using this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc (n::nat)

goal (1 subgoal):
 1. c\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc n
variables:
n :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ Suc (n::nat)

goal:
No subgoals!
variables:
i :: nat
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> c \<^sup>;^ (i::nat)

goal:
No subgoals!
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<star> \<sqsubseteq> \<Sqinter> range ((\<^sup>;^) c)

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "(\<Sqinter>i. c \<^sup>;^ i) \<sqsubseteq> (c \<^sup>;^ 0) \<sqinter> (\<Sqinter>i. c \<^sup>;^ Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c \<^sup>;^ (0::nat) \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i)
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (meson INF_greatest INF_lower UNIV_I le_inf_iff)
[PROOF STATE]
proof (state)
this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> c \<^sup>;^ 0 \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i)

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> c \<^sup>;^ 0 \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i)

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "... = nil \<sqinter> (\<Sqinter>i. c ; (c \<^sup>;^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<^sup>;^ (0::nat) \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i) = nil \<sqinter> (\<Sqinter>i::nat. c ; (c \<^sup>;^ i))
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) \<^sup>;^ 0 \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i) = nil \<sqinter> (\<Sqinter>i::nat. c ; (c \<^sup>;^ i))

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) \<^sup>;^ 0 \<sqinter> (\<Sqinter>i::nat. c \<^sup>;^ Suc i) = nil \<sqinter> (\<Sqinter>i::nat. c ; (c \<^sup>;^ i))

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "... = nil \<sqinter> c ; (\<Sqinter>i. c \<^sup>;^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nil \<sqinter> (\<Sqinter>i::nat. c ; (c \<^sup>;^ i)) = nil \<sqinter> c ; \<Sqinter> range ((\<^sup>;^) c)
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp add: seq_INF_distrib)
[PROOF STATE]
proof (state)
this:
nil \<sqinter> (\<Sqinter>i::nat. (c::'a::refinement_lattice) ; (c \<^sup>;^ i)) = nil \<sqinter> c ; \<Sqinter> range ((\<^sup>;^) c)

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> nil \<sqinter> c ; \<Sqinter> range ((\<^sup>;^) c)
[PROOF STEP]
show "(\<Sqinter>i. c \<^sup>;^ i) \<sqsubseteq> c\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> nil \<sqinter> c ; \<Sqinter> range ((\<^sup>;^) c)

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using fiter_induct
[PROOF STATE]
proof (prove)
using this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> nil \<sqinter> c ; \<Sqinter> range ((\<^sup>;^) c)
(?x::'a::refinement_lattice) \<sqsubseteq> (?d::'a::refinement_lattice) \<sqinter> (?c::'a::refinement_lattice) ; ?x \<Longrightarrow> ?x \<sqsubseteq> ?c\<^sup>\<star> ; ?d

goal (1 subgoal):
 1. \<Sqinter> range ((\<^sup>;^) c) \<sqsubseteq> c\<^sup>\<star>
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<Sqinter> range ((\<^sup>;^) (c::'a::refinement_lattice)) \<sqsubseteq> c\<^sup>\<star>

goal:
No subgoals!
variables:
c, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma short_vector_hybrid: assumes res: "short_vector_hybrid \<alpha> fs_init = v"
  and m0: "m \<noteq> 0"
shows "v \<in> carrier_vec n"
  "v \<in> L - {0\<^sub>v n}"
  "h \<in> L - {0\<^sub>v n} \<Longrightarrow> rat_of_int (sq_norm v) \<le> \<alpha> ^ (m - 1) * rat_of_int (sq_norm h)"
  "v \<noteq> 0\<^sub>v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<in> carrier_vec n &&& v \<in> L - {0\<^sub>v n}) &&& (h \<in> L - {0\<^sub>v n} \<Longrightarrow> rat_of_int \<parallel>v\<parallel>\<^sup>2 \<le> \<alpha> ^ (m - 1) * rat_of_int \<parallel>h\<parallel>\<^sup>2) &&& v \<noteq> 0\<^sub>v j
[PROOF STEP]
using short_vector[of v, OF _ m0] short_vector_external[of v, OF _ m0]
    res[unfolded short_vector_hybrid_def]
[PROOF STATE]
proof (prove)
using this:
LLL_Impl.short_vector \<alpha> fs_init = v \<Longrightarrow> v \<in> carrier_vec n
LLL_Impl.short_vector \<alpha> fs_init = v \<Longrightarrow> v \<in> L - {0\<^sub>v n}
\<lbrakk>LLL_Impl.short_vector \<alpha> fs_init = v; ?h \<in> L - {0\<^sub>v n}\<rbrakk> \<Longrightarrow> rat_of_int \<parallel>v\<parallel>\<^sup>2 \<le> \<alpha> ^ (m - 1) * rat_of_int \<parallel>?h\<parallel>\<^sup>2
LLL_Impl.short_vector \<alpha> fs_init = v \<Longrightarrow> v \<noteq> 0\<^sub>v ?j
short_vector_external \<alpha> fs_init = v \<Longrightarrow> v \<in> carrier_vec n
short_vector_external \<alpha> fs_init = v \<Longrightarrow> v \<in> L - {0\<^sub>v n}
\<lbrakk>short_vector_external \<alpha> fs_init = v; ?h \<in> L - {0\<^sub>v n}\<rbrakk> \<Longrightarrow> rat_of_int \<parallel>v\<parallel>\<^sup>2 \<le> \<alpha> ^ (m - 1) * rat_of_int \<parallel>?h\<parallel>\<^sup>2
short_vector_external \<alpha> fs_init = v \<Longrightarrow> v \<noteq> 0\<^sub>v ?j
(if enable_external_lll_solver then short_vector_external else LLL_Impl.short_vector) \<alpha> fs_init = v

goal (1 subgoal):
 1. (v \<in> carrier_vec n &&& v \<in> L - {0\<^sub>v n}) &&& (h \<in> L - {0\<^sub>v n} \<Longrightarrow> rat_of_int \<parallel>v\<parallel>\<^sup>2 \<le> \<alpha> ^ (m - 1) * rat_of_int \<parallel>h\<parallel>\<^sup>2) &&& v \<noteq> 0\<^sub>v j
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma to_fun_sub:
  assumes "g \<in> carrier P"
  assumes "f \<in> carrier P"
  assumes "a \<in> carrier R"
  shows "to_fun (f of  g) a = (to_fun f) (to_fun g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R f g) a = to_fun f (to_fun g a)
[PROOF STEP]
proof(rule poly_induct2[of f])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f \<in> carrier P
 2. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
 3. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
show "f \<in> carrier P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> carrier P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier P
f \<in> carrier P
a \<in> carrier R

goal (1 subgoal):
 1. f \<in> carrier P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> carrier P

goal (2 subgoals):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
 2. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
show "\<And>p. p \<in> carrier P \<Longrightarrow> degree p = 0 \<Longrightarrow> to_fun (p of g) a = to_fun p (to_fun g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
assume A0: "p \<in> carrier P"
[PROOF STATE]
proof (state)
this:
p \<in> carrier P

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
assume A1: "degree p = 0"
[PROOF STATE]
proof (state)
this:
deg R p = 0

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deg R p = 0
[PROOF STEP]
have P0: "degree (p of g) = 0"
[PROOF STATE]
proof (prove)
using this:
deg R p = 0

goal (1 subgoal):
 1. deg R (Cring_Poly.compose R p g) = 0
[PROOF STEP]
by (simp add: A0 assms(1) sub_const)
[PROOF STATE]
proof (state)
this:
deg R (Cring_Poly.compose R p g) = 0

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deg R (Cring_Poly.compose R p g) = 0
[PROOF STEP]
obtain b where b_def: "p of g = to_poly b \<and> b \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
deg R (Cring_Poly.compose R p g) = 0

goal (1 subgoal):
 1. (\<And>b. Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using A0 A1 cfs_closed assms(1) to_poly_inverse
[PROOF STATE]
proof (prove)
using this:
deg R (Cring_Poly.compose R p g) = 0
p \<in> carrier P
deg R p = 0
?f \<in> carrier P \<Longrightarrow> ?f ?n \<in> carrier R
g \<in> carrier P
\<lbrakk>?f \<in> carrier P; deg R ?f = 0\<rbrakk> \<Longrightarrow> ?f = to_polynomial R (?f 0)

goal (1 subgoal):
 1. (\<And>b. Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson sub_closed)
[PROOF STATE]
proof (state)
this:
Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R
[PROOF STEP]
have "to_fun (p of g) a = b"
[PROOF STATE]
proof (prove)
using this:
Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = b
[PROOF STEP]
by (simp add: assms(3) to_fun_to_poly)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = b

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
have "p of g = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R p g = p
[PROOF STEP]
using A0 A1 P_def sub_const UP_cring_axioms assms(1)
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
deg R p = 0
P \<equiv> UP R
\<lbrakk>?g \<in> carrier P; ?f \<in> carrier P; deg R ?f = 0\<rbrakk> \<Longrightarrow> Cring_Poly.compose R ?f ?g = ?f
UP_cring R
g \<in> carrier P

goal (1 subgoal):
 1. Cring_Poly.compose R p g = p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Cring_Poly.compose R p g = p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cring_Poly.compose R p g = p
[PROOF STEP]
have P1: "p = to_poly b"
[PROOF STATE]
proof (prove)
using this:
Cring_Poly.compose R p g = p

goal (1 subgoal):
 1. p = to_polynomial R b
[PROOF STEP]
using b_def
[PROOF STATE]
proof (prove)
using this:
Cring_Poly.compose R p g = p
Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R

goal (1 subgoal):
 1. p = to_polynomial R b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = to_polynomial R b

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
have "to_fun g a \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun g a \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier P
f \<in> carrier P
a \<in> carrier R

goal (1 subgoal):
 1. to_fun g a \<in> carrier R
[PROOF STEP]
by (simp add: to_fun_closed)
[PROOF STATE]
proof (state)
this:
to_fun g a \<in> carrier R

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p \<in> carrier P; deg R p = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_fun g a \<in> carrier R
[PROOF STEP]
show "to_fun (p of g) a =  to_fun p (to_fun g a)"
[PROOF STATE]
proof (prove)
using this:
to_fun g a \<in> carrier R

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
using P1 \<open>to_fun (p of g) a = b\<close> b_def
[PROOF STATE]
proof (prove)
using this:
to_fun g a \<in> carrier R
p = to_polynomial R b
to_fun (Cring_Poly.compose R p g) a = b
Cring_Poly.compose R p g = to_polynomial R b \<and> b \<in> carrier R

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
by (simp add: to_fun_to_poly)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?p1 \<in> carrier P; deg R ?p1 = 0\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R ?p1 g) a = to_fun ?p1 (to_fun g a)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
show "\<And>p. 0 < degree p \<Longrightarrow> p \<in> carrier P \<Longrightarrow>
            to_fun (trunc p of g) a = to_fun (trunc p) (to_fun g a) \<Longrightarrow>
            to_fun (p of g) a = to_fun p (to_fun g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
assume A0: "0 < degree p"
[PROOF STATE]
proof (state)
this:
0 < deg R p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
assume A1: " p \<in> carrier P"
[PROOF STATE]
proof (state)
this:
p \<in> carrier P

goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
assume A2: "to_fun (trunc p of g) a = to_fun (trunc p) (to_fun g a)"
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>0 < deg R p; p \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
show "to_fun (p of g) a = to_fun p (to_fun g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
have "p of g = (trunc p) of g \<oplus>\<^bsub>P\<^esub> (ltrm p) of g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R p g = Cring_Poly.compose R (Cring_Poly.truncate R p) g \<oplus>\<^bsub>P\<^esub> Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g
[PROOF STEP]
by (metis A1 assms(1) ltrm_closed sub_add trunc_simps(1) trunc_closed)
[PROOF STATE]
proof (state)
this:
Cring_Poly.compose R p g = Cring_Poly.compose R (Cring_Poly.truncate R p) g \<oplus>\<^bsub>P\<^esub> Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cring_Poly.compose R p g = Cring_Poly.compose R (Cring_Poly.truncate R p) g \<oplus>\<^bsub>P\<^esub> Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g
[PROOF STEP]
have "to_fun (p of g) a = to_fun ((trunc p) of g) a \<oplus> (to_fun ((ltrm p) of g) a)"
[PROOF STATE]
proof (prove)
using this:
Cring_Poly.compose R p g = Cring_Poly.compose R (Cring_Poly.truncate R p) g \<oplus>\<^bsub>P\<^esub> Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a
[PROOF STEP]
by (simp add: A1 assms(1) assms(3) to_fun_plus ltrm_closed sub_closed trunc_closed)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a
[PROOF STEP]
have 0: "to_fun (p of g) a = to_fun (trunc p) (to_fun g a) \<oplus> (to_fun ((ltrm p) of g) a)"
[PROOF STATE]
proof (prove)
using this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.compose R (Cring_Poly.truncate R p) g) a \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a
[PROOF STEP]
by (simp add: A2)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
have "(to_fun ((ltrm p) of g) a) = to_fun (ltrm p) (to_fun g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
using to_fun_sub_monom
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_UP_monom ?f; ?g \<in> carrier P; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R ?f ?g) ?a = to_fun ?f (to_fun ?g ?a)

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
by (simp add: A1 assms(1) assms(3) ltrm_is_UP_monom)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
have "to_fun (p of g) a = to_fun (trunc p) (to_fun g a) \<oplus>  to_fun (ltrm p) (to_fun g a)"
[PROOF STATE]
proof (prove)
using this:
to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a = to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (Cring_Poly.compose R (monom P (p (deg R p)) (deg R p)) g) a

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
to_fun (Cring_Poly.compose R p g) a = to_fun (Cring_Poly.truncate R p) (to_fun g a) \<oplus> to_fun (monom P (p (deg R p)) (deg R p)) (to_fun g a)

goal (1 subgoal):
 1. to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)
[PROOF STEP]
by (metis A1 assms(1) assms(3) to_fun_closed to_fun_plus ltrm_closed trunc_simps(1) trunc_closed)
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
to_fun (Cring_Poly.compose R p g) a = to_fun p (to_fun g a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < deg R ?p1; ?p1 \<in> carrier P; to_fun (Cring_Poly.compose R (Cring_Poly.truncate R ?p1) g) a = to_fun (Cring_Poly.truncate R ?p1) (to_fun g a)\<rbrakk> \<Longrightarrow> to_fun (Cring_Poly.compose R ?p1 g) a = to_fun ?p1 (to_fun g a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tmap_eq_TCons_conv:
  "tmap f g xs = TCons y ys \<longleftrightarrow>
  (\<exists>z zs. xs = TCons z zs \<and> f z = y \<and> tmap f g zs = ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (tmap f g xs = TCons y ys) = (\<exists>z zs. xs = TCons z zs \<and> f z = y \<and> tmap f g zs = ys)
[PROOF STEP]
by(cases xs) simp_all


[STATEMENT]
lemma cont_ccTTree1:
  "cont (\<lambda> S. ccTTree S G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cont (\<lambda>S. ccTTree S G)
[PROOF STEP]
apply (rule contI2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. monofun (\<lambda>S. ccTTree S G)
 2. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G)\<rbrakk> \<Longrightarrow> ccTTree (\<Squnion>i. Y i) G \<sqsubseteq> (\<Squnion>i. ccTTree (Y i) G)
[PROOF STEP]
apply (rule monofunI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. x \<sqsubseteq> y \<Longrightarrow> ccTTree x G \<sqsubseteq> ccTTree y G
 2. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G)\<rbrakk> \<Longrightarrow> ccTTree (\<Squnion>i. Y i) G \<sqsubseteq> (\<Squnion>i. ccTTree (Y i) G)
[PROOF STEP]
apply (erule ccTTree_mono1[folded below_set_def])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G)\<rbrakk> \<Longrightarrow> ccTTree (\<Squnion>i. Y i) G \<sqsubseteq> (\<Squnion>i. ccTTree (Y i) G)
[PROOF STEP]
apply (rule ttree_belowI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y xs. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G); xs \<in> paths (ccTTree (\<Squnion>i. Y i) G)\<rbrakk> \<Longrightarrow> xs \<in> paths (\<Squnion>i. ccTTree (Y i) G)
[PROOF STEP]
apply (simp add: paths_Either lub_set lub_is_either)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y xs. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G); xs \<in> valid_lists (\<Union> (range Y)) G\<rbrakk> \<Longrightarrow> xs = [] \<or> (\<exists>x. xs \<in> valid_lists (Y x) G)
[PROOF STEP]
apply (drule (1) valid_lists_chain1[rotated])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y xs. \<lbrakk>chain Y; chain (\<lambda>i. ccTTree (Y i) G); \<exists>i. xs \<in> valid_lists (Y i) G\<rbrakk> \<Longrightarrow> xs = [] \<or> (\<exists>x. xs \<in> valid_lists (Y x) G)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prv_eqv_refl: "\<phi> \<in> fmla \<Longrightarrow> prv (eqv \<phi> \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> \<in> fmla \<Longrightarrow> prv (eqv \<phi> \<phi>)
[PROOF STEP]
by (simp add: prv_cnjI prv_imp_refl eqv_def)


[STATEMENT]
lemma infinite_lessThan_int: "infinite {..<(n::int)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {..<n}
[PROOF STEP]
apply (simp only: atMost_remove[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite ({..n} - {n})
[PROOF STEP]
apply (rule Diff_infinite_finite[OF singleton_finite])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {..n}
[PROOF STEP]
apply (rule infinite_atMost_int)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma contour_integrable_neg_iff:
  "(\<lambda>x. -f x) contour_integrable_on g \<longleftrightarrow> f contour_integrable_on g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - f x) contour_integrable_on g) = (f contour_integrable_on g)
[PROOF STEP]
using contour_integrable_neg[of f g] contour_integrable_neg[of "\<lambda>x. -f x" g]
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g \<Longrightarrow> (\<lambda>x. - f x) contour_integrable_on g
(\<lambda>x. - f x) contour_integrable_on g \<Longrightarrow> (\<lambda>x. - (- f x)) contour_integrable_on g

goal (1 subgoal):
 1. ((\<lambda>x. - f x) contour_integrable_on g) = (f contour_integrable_on g)
[PROOF STEP]
by auto


[STATEMENT]
lemma pmf_transition_of_st_mat[simp]: "pmf (transition_of_st_mat A a) i = st_mat A $ i $ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (transition_of_st_mat A a) i = st_mat A $h i $h a
[PROOF STEP]
unfolding transition_of_st_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (pmf_of_st_vec (transition_vec_of_st_mat A a)) i = st_mat A $h i $h a
[PROOF STEP]
by (transfer, auto simp: measure_def)


[STATEMENT]
lemma symmetric_point_uniqueness:
  assumes "P Midpoint A P1" and
    "P Midpoint A P2"
  shows "P1 = P2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 = P2
[PROOF STEP]
by (metis Midpoint_def assms(1) assms(2) between_cong_3 cong_diff_4 cong_inner_transitivity)


[STATEMENT]
lemma word_less_minus_cancel: "y - x < z - x \<Longrightarrow> x \<le> z \<Longrightarrow> y < z"
  for x y z :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y - x < z - x; x \<le> z\<rbrakk> \<Longrightarrow> y < z
[PROOF STEP]
by uint_arith


[STATEMENT]
lemma vrestr_image:
  assumes "x \<in> f--`A"
  shows "x \<in> space M" "f x \<in> space M" "f x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> space M &&& f x \<in> space M &&& f x \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> f --` A

goal (1 subgoal):
 1. x \<in> space M &&& f x \<in> space M &&& f x \<in> A
[PROOF STEP]
unfolding vimage_restr_def
[PROOF STATE]
proof (prove)
using this:
x \<in> f -` (A \<inter> space M) \<inter> space M

goal (1 subgoal):
 1. x \<in> space M &&& f x \<in> space M &&& f x \<in> A
[PROOF STEP]
by auto


[STATEMENT]
lemma pcompose_prod: "pcompose (prod f A) p = prod (\<lambda>i. pcompose (f i) p) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A \<circ>\<^sub>p p = (\<Prod>i\<in>A. f i \<circ>\<^sub>p p)
[PROOF STEP]
by (induct A rule: infinite_finite_induct) (simp_all add: pcompose_1 pcompose_mult)


[STATEMENT]
lemma last_index_less_size_conv:
  "(last_index xs x < size xs) = (x : set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (last_index xs x < length xs) = (x \<in> set xs)
[PROOF STEP]
by(simp add: last_index_def Let_def index_size_conv length_pos_if_in_set
        del:length_greater_0_conv)


[STATEMENT]
lemma support_impl_in: "G e \<longrightarrow> support (\<lambda>l s.  H e l s) \<subseteq> T
  \<Longrightarrow> support (\<lambda>l s. G e \<longrightarrow>  H e l s) \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G e \<longrightarrow> support (H e) \<subseteq> T \<Longrightarrow> support (\<lambda>l s. G e \<longrightarrow> H e l s) \<subseteq> T
[PROOF STEP]
unfolding support_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G e \<longrightarrow> {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> H e l1 s \<noteq> H e l2 s} \<subseteq> T \<Longrightarrow> {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> (G e \<longrightarrow> H e l1 s) \<noteq> (G e \<longrightarrow> H e l2 s)} \<subseteq> T
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x l1 l2 s. \<lbrakk>\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y; {x. \<exists>l1 l2. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> (\<exists>s. H e l1 s = (\<not> H e l2 s))} \<subseteq> T; G e; \<not> H e l2 s; H e l1 s\<rbrakk> \<Longrightarrow> x \<in> T
 2. \<And>x l1 l2 s. \<lbrakk>\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y; {x. \<exists>l1 l2. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> (\<exists>s. H e l1 s = (\<not> H e l2 s))} \<subseteq> T; x \<notin> T; G e; \<not> H e l1 s; H e l2 s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma temp_dyn_up_real_arith:
  assumes "a > 0" and Thyps: "Tmin \<le> T" "T \<le> Tmax" "Tmax < (L::real)"
    and thyps: "0 \<le> t" "\<forall>\<tau>\<in>{0..t}. \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a) "
  shows "L - Tmax \<le> exp (-(a * t)) * (L - T)"
    and "L - exp (-(a * t)) * (L - T) \<le> Tmax"
    and "Tmin \<le> L - exp (-(a * t)) * (L - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T) &&& L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax &&& Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
have "0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)
[PROOF STEP]
using thyps
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
\<forall>\<tau>\<in>{0..t}. \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (1 subgoal):
 1. 0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
hence "ln ((L - Tmax) / (L - T)) \<le> - a * t \<and> - a * t \<le> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (1 subgoal):
 1. ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0
[PROOF STEP]
using assms(1) divide_le_cancel
[PROOF STATE]
proof (prove)
using this:
0 \<le> t \<and> t \<le> - (ln ((L - Tmax) / (L - T)) / a)
0 < a
(?a / ?c \<le> ?b / ?c) = (((0::?'a) < ?c \<longrightarrow> ?a \<le> ?b) \<and> (?c < (0::?'a) \<longrightarrow> ?b \<le> ?a))

goal (1 subgoal):
 1. ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
have "(L - Tmax) / (L - T) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (L - Tmax) / (L - T)
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L

goal (1 subgoal):
 1. 0 < (L - Tmax) / (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (L - Tmax) / (L - T)

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0
0 < (L - Tmax) / (L - T)
[PROOF STEP]
have "(L - Tmax) / (L - T) \<le> exp (-a * t) \<and> exp (-a * t) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0
0 < (L - Tmax) / (L - T)

goal (1 subgoal):
 1. (L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1
[PROOF STEP]
using exp_ln exp_le_one_iff
[PROOF STATE]
proof (prove)
using this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> t \<and> - a \<cdot> t \<le> 0
0 < (L - Tmax) / (L - T)
0 < ?x \<Longrightarrow> exp (ln ?x) = ?x
(exp ?x \<le> 1) = (?x \<le> 0)

goal (1 subgoal):
 1. (L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1
[PROOF STEP]
by (metis exp_less_cancel_iff not_less)
[PROOF STATE]
proof (state)
this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
have "L - T > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < L - T
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L

goal (1 subgoal):
 1. 0 < L - T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < L - T

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1
0 < L - T
[PROOF STEP]
have obs: "(L - Tmax) \<le> exp (-a * t) * (L - T) \<and> exp (-a * t) * (L - T) \<le> (L - T)"
[PROOF STATE]
proof (prove)
using this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> t) \<and> exp (- a \<cdot> t) \<le> 1
0 < L - T

goal (1 subgoal):
 1. L - Tmax \<le> exp (- a \<cdot> t) \<cdot> (L - T) \<and> exp (- a \<cdot> t) \<cdot> (L - T) \<le> L - T
[PROOF STEP]
by (simp add: pos_divide_le_eq)
[PROOF STATE]
proof (state)
this:
L - Tmax \<le> exp (- a \<cdot> t) \<cdot> (L - T) \<and> exp (- a \<cdot> t) \<cdot> (L - T) \<le> L - T

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
thus "(L - Tmax) \<le> exp (-(a * t)) * (L - T)"
[PROOF STATE]
proof (prove)
using this:
L - Tmax \<le> exp (- a \<cdot> t) \<cdot> (L - T) \<and> exp (- a \<cdot> t) \<cdot> (L - T) \<le> L - T

goal (1 subgoal):
 1. L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)

goal (2 subgoals):
 1. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
 2. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
thus "L - exp (-(a * t)) * (L - T) \<le> Tmax"
[PROOF STATE]
proof (prove)
using this:
L - Tmax \<le> exp (- (a \<cdot> t)) \<cdot> (L - T)

goal (1 subgoal):
 1. L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L - exp (- (a \<cdot> t)) \<cdot> (L - T) \<le> Tmax

goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
show "Tmin \<le> L - exp (-(a * t)) * (L - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
using Thyps and obs
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L
L - Tmax \<le> exp (- a \<cdot> t) \<cdot> (L - T) \<and> exp (- a \<cdot> t) \<cdot> (L - T) \<le> L - T

goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_wrt_linorder_index_less_iff:
  assumes "linorder_on A R" "set xs \<subseteq> A" "sorted_wrt R xs"
          "x \<in> set xs" "y \<in> set xs"
  shows   "index xs x < index xs y \<longleftrightarrow> (y,x) \<notin> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (index xs x < index xs y) = ((y, x) \<notin> R)
[PROOF STEP]
by (subst sorted_wrt_linorder_index_le_iff[OF assms(1-3) assms(5,4), symmetric]) auto


[STATEMENT]
lemma less_eq_funI [intro?]:
  assumes "\<exists>c>0. \<exists>n. \<forall>m>n. f m \<le> c * g m"
  shows "f \<lesssim> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<lesssim> g
[PROOF STEP]
unfolding less_eq_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c>0. \<exists>n. \<forall>m>n. f m \<le> c * g m
[PROOF STEP]
by (rule assms)


[STATEMENT]
lemma elem_index_inj:
  assumes "elem_index x = elem_index y"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using inj_elem_index assms
[PROOF STATE]
proof (prove)
using this:
inj elem_index
elem_index x = elem_index y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (rule injD)


[STATEMENT]
lemma primepow_cases:
  "primepow d \<longleftrightarrow>
     (  primepow_even d \<and> \<not> primepow_odd d \<and> \<not> prime d) \<or>
     (\<not> primepow_even d \<and>   primepow_odd d \<and> \<not> prime d) \<or>
     (\<not> primepow_even d \<and> \<not> primepow_odd d \<and>   prime d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primepow d = (primepow_even d \<and> \<not> primepow_odd d \<and> \<not> prime d \<or> \<not> primepow_even d \<and> primepow_odd d \<and> \<not> prime d \<or> \<not> primepow_even d \<and> \<not> primepow_odd d \<and> prime d)
[PROOF STEP]
by (auto simp: primepow_even_altdef primepow_odd_altdef multiplicity_aprimedivisor_Suc_0_iff
           elim!: oddE intro!: Nat.gr0I)


[STATEMENT]
lemma sum_length_partition_by_median:
  assumes "(l, m, r) = partition_by_median k ps"
  shows "length ps = length l + length r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ps = length l + length r
[PROOF STEP]
using assms sum_length_filter_compl[of "(\<lambda>p. p $ k \<le> axis_median k ps)"]
[PROOF STATE]
proof (prove)
using this:
(l, m, r) = partition_by_median k ps
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ?xs) + length (filter (\<lambda>x. \<not> x $ k \<le> axis_median k ps) ?xs) = length ?xs

goal (1 subgoal):
 1. length ps = length l + length r
[PROOF STEP]
unfolding partition_by_median_def
[PROOF STATE]
proof (prove)
using this:
(l, m, r) = (let m = axis_median k ps; (l, r) = partition (\<lambda>p. p $ k \<le> m) ps in (l, m, r))
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ?xs) + length (filter (\<lambda>x. \<not> x $ k \<le> axis_median k ps) ?xs) = length ?xs

goal (1 subgoal):
 1. length ps = length l + length r
[PROOF STEP]
by (simp add: Let_def o_def)