[STATEMENT]
lemma self_bij_0_k:
  fixes a k :: nat
  assumes "coprime a k" "[a*i = 1] (mod k)" "k > 0"
  shows "bij_betw (\<lambda>r. r*a mod k) {0..k-1} {0..k-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>r. r * a mod k) {0..k - 1} {0..k - 1}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1} \<and> (\<lambda>r. r * a mod k) ` {0..k - 1} = {0..k - 1}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
 2. (\<lambda>r. r * a mod k) ` {0..k - 1} = {0..k - 1}
[PROOF STEP]
show "inj_on (\<lambda>r. r*a mod k) {0..k-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
fix r1 r2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
assume in_k: "r1 \<in> {0..k-1}" "r2 \<in> {0..k-1}"
[PROOF STATE]
proof (state)
this:
r1 \<in> {0..k - 1}
r2 \<in> {0..k - 1}

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
assume as: "[r1*a = r2*a] (mod k)"
[PROOF STATE]
proof (state)
this:
[r1 * a = r2 * a] (mod k)

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[r1 * a = r2 * a] (mod k)
[PROOF STEP]
have "[r1*a*i = r2*a*i] (mod k)"
[PROOF STATE]
proof (prove)
using this:
[r1 * a = r2 * a] (mod k)

goal (1 subgoal):
 1. [r1 * a * i = r2 * a * i] (mod k)
[PROOF STEP]
using cong_scalar_right
[PROOF STATE]
proof (prove)
using this:
[r1 * a = r2 * a] (mod k)
[?b = ?c] (mod ?a) \<Longrightarrow> [?b * ?d = ?c * ?d] (mod ?a)

goal (1 subgoal):
 1. [r1 * a * i = r2 * a * i] (mod k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[r1 * a * i = r2 * a * i] (mod k)

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[r1 * a * i = r2 * a * i] (mod k)
[PROOF STEP]
have "[r1 = r2] (mod k)"
[PROOF STATE]
proof (prove)
using this:
[r1 * a * i = r2 * a * i] (mod k)

goal (1 subgoal):
 1. [r1 = r2] (mod k)
[PROOF STEP]
using cong_mult_rcancel_nat as assms(1)
[PROOF STATE]
proof (prove)
using this:
[r1 * a * i = r2 * a * i] (mod k)
coprime ?k ?m \<Longrightarrow> [?a * ?k = ?b * ?k] (mod ?m) = [?a = ?b] (mod ?m)
[r1 * a = r2 * a] (mod k)
coprime a k

goal (1 subgoal):
 1. [r1 = r2] (mod k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[r1 = r2] (mod k)

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[r1 = r2] (mod k)
[PROOF STEP]
have "r1 = r2"
[PROOF STATE]
proof (prove)
using this:
[r1 = r2] (mod k)

goal (1 subgoal):
 1. r1 = r2
[PROOF STEP]
using in_k
[PROOF STATE]
proof (prove)
using this:
[r1 = r2] (mod k)
r1 \<in> {0..k - 1}
r2 \<in> {0..k - 1}

goal (1 subgoal):
 1. r1 = r2
[PROOF STEP]
using assms(3) cong_less_modulus_unique_nat
[PROOF STATE]
proof (prove)
using this:
[r1 = r2] (mod k)
r1 \<in> {0..k - 1}
r2 \<in> {0..k - 1}
0 < k
\<lbrakk>[?x = ?y] (mod ?m); ?x < ?m; ?y < ?m\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. r1 = r2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r1 = r2

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?r1.2 \<in> {0..k - 1}; ?r2.2 \<in> {0..k - 1}; [?r1.2 * a = ?r2.2 * a] (mod k)\<rbrakk> \<Longrightarrow> ?r1.2 = ?r2.2

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
note eq = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?r1.2 \<in> {0..k - 1}; ?r2.2 \<in> {0..k - 1}; [?r1.2 * a = ?r2.2 * a] (mod k)\<rbrakk> \<Longrightarrow> ?r1.2 = ?r2.2

goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>r. r * a mod k) {0..k - 1}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..k - 1}. \<forall>y\<in>{0..k - 1}. x * a mod k = y * a mod k \<longrightarrow> x = y
[PROOF STEP]
by (safe, simp add: eq cong_def)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>r. r * a mod k) {0..k - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>r. r * a mod k) {0..k - 1}

goal (1 subgoal):
 1. (\<lambda>r. r * a mod k) ` {0..k - 1} = {0..k - 1}
[PROOF STEP]
define f where "f = (\<lambda>r. r * a mod k)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>r. r * a mod k)

goal (1 subgoal):
 1. (\<lambda>r. r * a mod k) ` {0..k - 1} = {0..k - 1}
[PROOF STEP]
show "f ` {0..k - 1} = {0..k - 1} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {0..k - 1} = {0..k - 1}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} = {0..k - 1}
[PROOF STEP]
proof (standard)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
 2. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
show "{y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
assume "y \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}"
[PROOF STATE]
proof (state)
this:
y \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
obtain x where "y = f x"
[PROOF STATE]
proof (prove)
using this:
y \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal (1 subgoal):
 1. (\<And>x. y = f x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y = f x

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = f x
[PROOF STEP]
have "y \<in> {0..k-1}"
[PROOF STATE]
proof (prove)
using this:
y = f x

goal (1 subgoal):
 1. y \<in> {0..k - 1}
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
y = x * a mod k

goal (1 subgoal):
 1. y \<in> {0..k - 1}
[PROOF STEP]
using Suc_pred assms(3) lessThan_Suc_atMost
[PROOF STATE]
proof (prove)
using this:
y = x * a mod k
0 < ?n \<Longrightarrow> Suc (?n - Suc 0) = ?n
0 < k
{..<Suc ?k} = {..?k}

goal (1 subgoal):
 1. y \<in> {0..k - 1}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
y \<in> {0..k - 1}

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?y2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x} \<Longrightarrow> ?y2 \<in> {0..k - 1}

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x} \<Longrightarrow> ?y2 \<in> {0..k - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?y2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x} \<Longrightarrow> ?y2 \<in> {0..k - 1}

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{y. \<exists>x\<in>{0..k - 1}. y = f x} \<subseteq> {0..k - 1}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
show "{0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
assume ass: "x \<in> {0..k-1}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..k - 1}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..k - 1}
[PROOF STEP]
have "x * i mod k \<in> {0..k-1}"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..k - 1}

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> {0..k - 1} \<Longrightarrow> x * i mod k \<in> {0..k - 1}
[PROOF STEP]
have "x * i mod k \<in> {0..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * i mod k \<in> {0..<k}
[PROOF STEP]
by (simp add: assms(3))
[PROOF STATE]
proof (state)
this:
x * i mod k \<in> {0..<k}

goal (1 subgoal):
 1. x \<in> {0..k - 1} \<Longrightarrow> x * i mod k \<in> {0..k - 1}
[PROOF STEP]
have "{0..<k} = {0..k-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<k} = {0..k - 1}
[PROOF STEP]
using Suc_diff_1 assms(3)
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> Suc (?n - 1) = ?n
0 < k

goal (1 subgoal):
 1. {0..<k} = {0..k - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<k} = {0..k - 1}

goal (1 subgoal):
 1. x \<in> {0..k - 1} \<Longrightarrow> x * i mod k \<in> {0..k - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1}
[PROOF STEP]
using \<open>x * i mod k \<in> {0..<k}\<close> \<open>{0..<k} = {0..k-1}\<close>
[PROOF STATE]
proof (prove)
using this:
x * i mod k \<in> {0..<k}
{0..<k} = {0..k - 1}

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x * i mod k \<in> {0..k - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x * i mod k \<in> {0..k - 1}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * i mod k \<in> {0..k - 1}
[PROOF STEP]
have "f (x * i mod k) = x"
[PROOF STATE]
proof (prove)
using this:
x * i mod k \<in> {0..k - 1}

goal (1 subgoal):
 1. f (x * i mod k) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
have "f (x * i mod k) = (x * i mod k) * a mod k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x * i mod k) = x * i mod k * a mod k
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * i mod k * a mod k = x * i mod k * a mod k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (x * i mod k) = x * i mod k * a mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (x * i mod k) = x * i mod k * a mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
have "\<dots> = (x*i*a) mod k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * i mod k * a mod k = x * i * a mod k
[PROOF STEP]
by (simp add: mod_mult_left_eq)
[PROOF STATE]
proof (state)
this:
x * i mod k * a mod k = x * i * a mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * i mod k * a mod k = x * i * a mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
have "\<dots> = (x*1) mod k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * i * a mod k = x * 1 mod k
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
[a * i = 1] (mod k)

goal (1 subgoal):
 1. x * i * a mod k = x * 1 mod k
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
a * i mod k = 1 mod k

goal (1 subgoal):
 1. x * i * a mod k = x * 1 mod k
[PROOF STEP]
by (subst mult.assoc, subst (2) mult.commute,
               subst mod_mult_right_eq[symmetric],simp)
[PROOF STATE]
proof (state)
this:
x * i * a mod k = x * 1 mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * i * a mod k = x * 1 mod k

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
have "\<dots> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 1 mod k = x
[PROOF STEP]
using ass assms(3)
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..k - 1}
0 < k

goal (1 subgoal):
 1. x * 1 mod k = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x * 1 mod k = x

goal (1 subgoal):
 1. x * i mod k \<in> {0..k - 1} \<Longrightarrow> f (x * i mod k) = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f (x * i mod k) = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (x * i mod k) = x

goal (1 subgoal):
 1. f (x * i mod k) = x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f (x * i mod k) = x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (x * i mod k) = x

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (x * i mod k) = x
[PROOF STEP]
have "x \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}"
[PROOF STATE]
proof (prove)
using this:
f (x * i mod k) = x

goal (1 subgoal):
 1. x \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
using \<open>x * i mod k \<in> {0..k-1}\<close>
[PROOF STATE]
proof (prove)
using this:
f (x * i mod k) = x
x * i mod k \<in> {0..k - 1}

goal (1 subgoal):
 1. x \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> {0..k - 1} \<Longrightarrow> ?x2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> {0..k - 1} \<Longrightarrow> ?x2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> {0..k - 1} \<Longrightarrow> ?x2 \<in> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal (1 subgoal):
 1. {0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{0..k - 1} \<subseteq> {y. \<exists>x\<in>{0..k - 1}. y = f x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` {0..k - 1} = {0..k - 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_ex2: "(a mod (2::nat) = 0) = (\<exists> q. a = 2 * q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even a = (\<exists>q. a = 2 * q)
[PROOF STEP]
by arith


[STATEMENT]
lemma Un_infinite_iff: "infinite (S \<union> T) = (infinite S \<or> infinite T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (S \<union> T) = (infinite S \<or> infinite T)
[PROOF STEP]
by blast


[STATEMENT]
lemma r_P2:
  assumes b: "b < q" and x: "x < q" and y: "y < q" and r: "r < q"
  shows
    "((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) =
              ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q,
                      (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)
[PROOF STEP]
have  "(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
have 1:"r = (x*((y + (q - b)) mod q) + (q - ((x*((y + (q - b)) mod q) + (q - r)) mod q))) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
[PROOF STEP]
using assms secure_mult.r secure_mult_axioms
[PROOF STATE]
proof (prove)
using this:
b < q
x < q
y < q
r < q
\<lbrakk>secure_mult ?q; ?e1.0 = (?y + (?q - ?b)) mod ?q; ?s1.0 = (?x * ((?y + (?q - ?b)) mod ?q) + (?q - ?r)) mod ?q; ?b < ?q; ?x < ?q; ?y < ?q; ?r < ?q\<rbrakk> \<Longrightarrow> ?r = (?x * ?e1.0 + (?q - ?s1.0)) mod ?q
secure_mult q

goal (1 subgoal):
 1. r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
have "?rhs = (x*((y + (q - b)) mod q) + (q - ((x*((y + (q - b)) mod q) + (q - r)) mod q))) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
[PROOF STEP]
using assms 1
[PROOF STATE]
proof (prove)
using this:
b < q
x < q
y < q
r < q
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
using assms 1
[PROOF STATE]
proof (prove)
using this:
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q
b < q
x < q
y < q
r < q
r = (x * ((y + (q - b)) mod q) + (q - (x * ((y + (q - b)) mod q) + (q - r)) mod q)) mod q

goal (1 subgoal):
 1. (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r

goal (1 subgoal):
 1. ((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r

goal (1 subgoal):
 1. ((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q = r
b < q
x < q
y < q
r < q

goal (1 subgoal):
 1. ((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((x, a, r, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q) = ((x, a, (x * ((y + q - b) mod q) + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q, (y + q - b) mod q), (x * ((y + q - b) mod q) + q - r) mod q, (x * y + q - (x * ((y + q - b) mod q) + q - r) mod q) mod q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma church_rosser_equiv: "y\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> y\<^sup>\<star> \<longleftrightarrow> (x + y)\<^sup>\<star> = x\<^sup>\<star> \<cdot> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> y\<^sup>\<star>) = ((x + y)\<^sup>\<star> = x\<^sup>\<star> \<cdot> y\<^sup>\<star>)
[PROOF STEP]
using church_rosser_to_confluence order.eq_iff
[PROOF STATE]
proof (prove)
using this:
(?x + ?y)\<^sup>\<star> \<le> ?x\<^sup>\<star> \<cdot> ?y\<^sup>\<star> \<Longrightarrow> ?y\<^sup>\<star> \<cdot> ?x\<^sup>\<star> \<le> ?x\<^sup>\<star> \<cdot> ?y\<^sup>\<star>
(?a = ?b) = (?a \<le> ?b \<and> ?b \<le> ?a)

goal (1 subgoal):
 1. (y\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> y\<^sup>\<star>) = ((x + y)\<^sup>\<star> = x\<^sup>\<star> \<cdot> y\<^sup>\<star>)
[PROOF STEP]
by blast


[STATEMENT]
lemma "kauff_mat ([cup,cup]*(basic [cap,cap]))= [[((A^4)+(B^4)) + 2]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kauff_mat ([cup, cup] * basic [cap, cap]) = [[rat_poly_plus (rat_poly_plus (A ^ 4) (B ^ 4)) 2]]
[PROOF STEP]
apply(simp add:mat_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matT_vec_multI 0 rat_poly_plus rat_poly_times (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [rat_poly_times A A] (map2 (#) [rat_poly_inv (rat_poly_times A B)] (map2 (#) [0] (map2 (#) [0] (map2 (#) [rat_poly_inv (rat_poly_times B A)] (map2 (#) [rat_poly_times B B] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (replicate (rat_poly.row_length [[0], [0], [0], [0], [0], [rat_poly_times A A], [rat_poly_inv (rat_poly_times A B)], [0], [0], [rat_poly_inv (rat_poly_times B A)], [rat_poly_times B B], [0], [0], [0], [0], [0]]) []))))))))))))))))) [0, 0, 0, 0, 0, rat_poly_times A A, rat_poly_inv (rat_poly_times A B), 0, 0, rat_poly_inv (rat_poly_times B A), rat_poly_times B B, 0, 0, 0, 0, 0] = [rat_poly_plus (rat_poly_plus (A ^ 4) (B ^ 4)) 2]
[PROOF STEP]
apply(simp add:matT_vec_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<lambda>w. scalar_prod w [0, 0, 0, 0, 0, rat_poly_times A A, rat_poly_inv (rat_poly_times A B), 0, 0, rat_poly_inv (rat_poly_times B A), rat_poly_times B B, 0, 0, 0, 0, 0]) \<circ> (\<lambda>(x, y). x # y)) (zip [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [rat_poly_times A A] (map2 (#) [rat_poly_inv (rat_poly_times A B)] (map2 (#) [0] (map2 (#) [0] (map2 (#) [rat_poly_inv (rat_poly_times B A)] (map2 (#) [rat_poly_times B B] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (map2 (#) [0] (replicate (rat_poly.row_length [[0], [0], [0], [0], [0], [rat_poly_times A A], [rat_poly_inv (rat_poly_times A B)], [0], [0], [rat_poly_inv (rat_poly_times B A)], [rat_poly_times B B], [0], [0], [0], [0], [0]]) []))))))))))))))))) = [rat_poly_plus (rat_poly_plus (A ^ 4) (B ^ 4)) 2]
[PROOF STEP]
apply(auto simp add:replicate_def rat_poly.row_length_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod [0, 0, 0, 0, 0, rat_poly_times A A, rat_poly_inv (rat_poly_times A B), 0, 0, rat_poly_inv (rat_poly_times B A), rat_poly_times B B, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, rat_poly_times A A, rat_poly_inv (rat_poly_times A B), 0, 0, rat_poly_inv (rat_poly_times B A), rat_poly_times B B, 0, 0, 0, 0, 0] = rat_poly_plus (rat_poly_plus (A ^ 4) (B ^ 4)) 2
[PROOF STEP]
apply(auto simp add:scalar_prod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_plus (rat_poly_times (rat_poly_times A A) (rat_poly_times A A)) (rat_poly_plus (rat_poly_times 2 (rat_poly_times A (rat_poly_times A (rat_poly_times B B)))) (rat_poly_times (rat_poly_times B B) (rat_poly_times B B))) = rat_poly_plus (rat_poly_plus (A ^ 4) (B ^ 4)) 2
[PROOF STEP]
apply(auto simp add:unlink_computation)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem Gromov_completion_dist_comparison [mono_intros]:
  fixes x y::"('a::Gromov_hyperbolic_space) Gromov_completion"
  shows "ereal(dist x y) \<le> esqrt(extended_Gromov_distance x y)"
        "ereal(dist x y) \<le> eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y)"
        "min (esqrt(extended_Gromov_distance x y)) (eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal(dist x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y) &&& ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) &&& min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y)
 2. ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
 3. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
interpret Turn_into_distance extended_predist
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Turn_into_distance extended_predist
[PROOF STEP]
by (standard, auto intro: extended_predist_weak_triangle extended_predist_commute)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y)
 2. ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
 3. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
have "ereal(dist x y) \<le> ereal(extended_predist x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (dist x y) \<le> ereal (extended_predist x y)
[PROOF STEP]
unfolding dist_Gromov_completion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (turn_into_distance extended_predist x y) \<le> ereal (extended_predist x y)
[PROOF STEP]
by (auto intro!: upper mono_intros)
[PROOF STATE]
proof (state)
this:
ereal (dist x y) \<le> ereal (extended_predist x y)

goal (3 subgoals):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y)
 2. ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
 3. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ereal (dist x y) \<le> ereal (extended_predist x y)
[PROOF STEP]
show "ereal(dist x y) \<le> esqrt(extended_Gromov_distance x y)"
            "ereal(dist x y) \<le> eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y)"
[PROOF STATE]
proof (prove)
using this:
ereal (dist x y) \<le> ereal (extended_predist x y)

goal (1 subgoal):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y) &&& ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
[PROOF STEP]
unfolding extended_predist_ereal
[PROOF STATE]
proof (prove)
using this:
ereal (dist x y) \<le> min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y))

goal (1 subgoal):
 1. ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y) &&& ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal (dist x y) \<le> esqrt (extended_Gromov_distance x y)
ereal (dist x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
have "ereal(extended_predist x y) \<le> ereal(2 * dist x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (extended_predist x y) \<le> ereal (2 * dist x y)
[PROOF STEP]
unfolding dist_Gromov_completion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (extended_predist x y) \<le> ereal (2 * turn_into_distance extended_predist x y)
[PROOF STEP]
by (auto intro!: lower mono_intros)
[PROOF STATE]
proof (state)
this:
ereal (extended_predist x y) \<le> ereal (2 * dist x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ereal (extended_predist x y) \<le> ereal (2 * dist x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
have "... = 2 * ereal (dist x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (2 * dist x y) = 2 * ereal (dist x y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ereal (2 * dist x y) = 2 * ereal (dist x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ereal (extended_predist x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
show "min (esqrt(extended_Gromov_distance x y)) (eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal(dist x y)"
[PROOF STATE]
proof (prove)
using this:
ereal (extended_predist x y) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
unfolding extended_predist_ereal
[PROOF STATE]
proof (prove)
using this:
min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma assoc_in_hom [intro]:
    assumes "ide a" and "ide b" and "ide c"
    shows "\<guillemotleft>\<a>[a, b, c] : (a \<otimes> b) \<otimes> c \<rightarrow> a \<otimes> (b \<otimes> c)\<guillemotright>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>\<a>[a, b, c] : (a \<otimes> b) \<otimes> c \<rightarrow> a \<otimes> b \<otimes> c\<guillemotright>
[PROOF STEP]
using assms assoc_def
[PROOF STATE]
proof (prove)
using this:
ide a
ide b
ide c
\<a>[?a, ?b, ?c] \<equiv> \<langle>\<pp>\<^sub>1[?a, ?b] \<cdot> \<pp>\<^sub>1[?a \<otimes> ?b, ?c], \<langle>\<pp>\<^sub>0[?a, ?b] \<cdot> \<pp>\<^sub>1[?a \<otimes> ?b, ?c], \<pp>\<^sub>0[?a \<otimes> ?b, ?c]\<rangle>\<rangle>

goal (1 subgoal):
 1. \<guillemotleft>\<a>[a, b, c] : (a \<otimes> b) \<otimes> c \<rightarrow> a \<otimes> b \<otimes> c\<guillemotright>
[PROOF STEP]
by auto


[STATEMENT]
lemma rank_strict_mono:
  assumes "finite S"
  shows "strict_mono_on S (\<lambda>x. rank_of x S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono_on S (\<lambda>x. rank_of x S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. strict_mono_on S (\<lambda>x. rank_of x S)
[PROOF STEP]
have "\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> x < y \<Longrightarrow> rank_of x S < rank_of y S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x < y\<rbrakk> \<Longrightarrow> rank_of x S < rank_of y S
[PROOF STEP]
unfolding rank_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x < y\<rbrakk> \<Longrightarrow> card {y \<in> S. y < x} < card {ya \<in> S. ya < y}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x < y\<rbrakk> \<Longrightarrow> card {y \<in> S. y < x} < card {ya \<in> S. ya < y}
[PROOF STEP]
by (intro psubset_card_mono, auto)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?y \<in> S; ?x < ?y\<rbrakk> \<Longrightarrow> rank_of ?x S < rank_of ?y S

goal (1 subgoal):
 1. strict_mono_on S (\<lambda>x. rank_of x S)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S; ?x < ?y\<rbrakk> \<Longrightarrow> rank_of ?x S < rank_of ?y S

goal (1 subgoal):
 1. strict_mono_on S (\<lambda>x. rank_of x S)
[PROOF STEP]
by (simp add:rank_of_def strict_mono_on_def)
[PROOF STATE]
proof (state)
this:
strict_mono_on S (\<lambda>x. rank_of x S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_pos_iff: "summable f \<Longrightarrow> (\<And>n. 0 \<le> f n) \<Longrightarrow> 0 < suminf f \<longleftrightarrow> (\<exists>i. 0 < f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> ((0::'a) < suminf f) = (\<exists>i. (0::'a) < f i)
[PROOF STEP]
using sum_le_suminf[of "{}"] suminf_eq_zero_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>summable f; finite {}; \<And>n. n \<in> - {} \<Longrightarrow> (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> sum f {} \<le> suminf f
\<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> (suminf f = (0::'a)) = (\<forall>n. f n = (0::'a))

goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> ((0::'a) < suminf f) = (\<exists>i. (0::'a) < f i)
[PROOF STEP]
by (simp add: less_le)


[STATEMENT]
lemma yun_monic_factorization:
  fixes p :: "'a :: {field_char_0,euclidean_ring_gcd,semiring_gcd_mult_normalize} poly"
  assumes res: "yun_gcd.yun_monic_factorization gcd p = bs"
  and monic: "monic p"
  shows "square_free_factorization p (1,bs)" "(b,i) \<in> set bs \<Longrightarrow> monic b" "distinct (map snd bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_free_factorization p (1::'a, bs) &&& ((b, i) \<in> set bs \<Longrightarrow> monic b) &&& distinct (map snd bs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. square_free_factorization p (1::'a, bs)
 2. (b, i) \<in> set bs \<Longrightarrow> monic b
 3. distinct (map snd bs)
[PROOF STEP]
from monic_factorization[OF monic]
[PROOF STATE]
proof (chain)
picking this:
\<exists>as. monic_factorization as p
[PROOF STEP]
obtain as where "monic_factorization as p"
[PROOF STATE]
proof (prove)
using this:
\<exists>as. monic_factorization as p

goal (1 subgoal):
 1. (\<And>as. monic_factorization as p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
monic_factorization as p

goal (3 subgoals):
 1. square_free_factorization p (1::'a, bs)
 2. (b, i) \<in> set bs \<Longrightarrow> monic b
 3. distinct (map snd bs)
[PROOF STEP]
from "monic_factorization.yun_monic_factorization"[OF this res]
[PROOF STATE]
proof (chain)
picking this:
square_free_factorization p (1::'a, bs)
(?b, ?i) \<in> set bs \<Longrightarrow> monic ?b
distinct (map snd bs)
[PROOF STEP]
show "square_free_factorization p (1,bs)" "(b,i) \<in> set bs \<Longrightarrow> monic b" "distinct (map snd bs)"
[PROOF STATE]
proof (prove)
using this:
square_free_factorization p (1::'a, bs)
(?b, ?i) \<in> set bs \<Longrightarrow> monic ?b
distinct (map snd bs)

goal (1 subgoal):
 1. square_free_factorization p (1::'a, bs) &&& ((b, i) \<in> set bs \<Longrightarrow> monic b) &&& distinct (map snd bs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
square_free_factorization p (1::'a, bs)
(b, i) \<in> set bs \<Longrightarrow> monic b
distinct (map snd bs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size1_height_if_incomplete:
  "\<not> complete t \<Longrightarrow> size1 t < 2 ^ height t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> complete t \<Longrightarrow> size1 t < 2 ^ height t
[PROOF STEP]
proof(induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> complete \<langle>\<rangle> \<Longrightarrow> size1 \<langle>\<rangle> < 2 ^ height \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
\<not> complete \<langle>\<rangle>

goal (2 subgoals):
 1. \<not> complete \<langle>\<rangle> \<Longrightarrow> size1 \<langle>\<rangle> < 2 ^ height \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<not> complete \<langle>\<rangle>

goal (1 subgoal):
 1. size1 \<langle>\<rangle> < 2 ^ height \<langle>\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 \<langle>\<rangle> < 2 ^ height \<langle>\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case (Node l x r)
[PROOF STATE]
proof (state)
this:
\<not> complete l \<Longrightarrow> size1 l < 2 ^ height l
\<not> complete r \<Longrightarrow> size1 r < 2 ^ height r
\<not> complete \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
have 1: ?case if h: "height l < height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
using h size1_height[of l] size1_height[of r] power_strict_increasing[OF h, of "2::nat"]
[PROOF STATE]
proof (prove)
using this:
height l < height r
size1 l \<le> 2 ^ height l
size1 r \<le> 2 ^ height r
1 < 2 \<Longrightarrow> 2 ^ height l < 2 ^ height r

goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
by(auto simp: max_def simp del: power_strict_increasing_iff)
[PROOF STATE]
proof (state)
this:
height l < height r \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
have 2: ?case if h: "height l > height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
using h size1_height[of l] size1_height[of r] power_strict_increasing[OF h, of "2::nat"]
[PROOF STATE]
proof (prove)
using this:
height r < height l
size1 l \<le> 2 ^ height l
size1 r \<le> 2 ^ height r
1 < 2 \<Longrightarrow> 2 ^ height r < 2 ^ height l

goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
by(auto simp: max_def simp del: power_strict_increasing_iff)
[PROOF STATE]
proof (state)
this:
height r < height l \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
have 3: ?case if h: "height l = height r" and c: "\<not> complete l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
using h size1_height[of r] Node.IH(1)[OF c]
[PROOF STATE]
proof (prove)
using this:
height l = height r
size1 r \<le> 2 ^ height r
size1 l < 2 ^ height l

goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
\<lbrakk>height l = height r; \<not> complete l\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
have 4: ?case if h: "height l = height r" and c: "\<not> complete r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
using h size1_height[of l] Node.IH(2)[OF c]
[PROOF STATE]
proof (prove)
using this:
height l = height r
size1 l \<le> 2 ^ height l
size1 r < 2 ^ height r

goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
\<lbrakk>height l = height r; \<not> complete r\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>\<not> complete t1 \<Longrightarrow> size1 t1 < 2 ^ height t1; \<not> complete t2 \<Longrightarrow> size1 t2 < 2 ^ height t2; \<not> complete \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> < 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
from 1 2 3 4 Node.prems
[PROOF STATE]
proof (chain)
picking this:
height l < height r \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
height r < height l \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<lbrakk>height l = height r; \<not> complete l\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<lbrakk>height l = height r; \<not> complete r\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<not> complete \<langle>l, x, r\<rangle>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
height l < height r \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
height r < height l \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<lbrakk>height l = height r; \<not> complete l\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<lbrakk>height l = height r; \<not> complete r\<rbrakk> \<Longrightarrow> size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
\<not> complete \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>
[PROOF STEP]
apply (simp add: max_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>height l < height r \<Longrightarrow> size1 l + size1 r < 2 * 2 ^ height r; height r < height l \<Longrightarrow> size1 l + size1 r < 2 * 2 ^ height l; \<lbrakk>height l = height r; \<not> complete l\<rbrakk> \<Longrightarrow> size1 l + size1 r < 2 * 2 ^ height r; \<lbrakk>height l = height r; \<not> complete r\<rbrakk> \<Longrightarrow> size1 l + size1 r < 2 * 2 ^ height r; complete l \<longrightarrow> height l = height r \<longrightarrow> \<not> complete r\<rbrakk> \<Longrightarrow> height l \<le> height r \<longrightarrow> size1 l + size1 r < 2 * 2 ^ height r
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, x, r\<rangle> < 2 ^ height \<langle>l, x, r\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ball_rangeC_singleton:
  "(\<forall>x \<in> rangeC {f}. P x) \<longleftrightarrow> (\<forall>x. P (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>rangeC {f}. P x) = (\<forall>x. P (f x))
[PROOF STEP]
by(simp add: Ball_rangeC_iff)


[STATEMENT]
lemma sorted_from_radix_sort:
  "\<lbrakk> cols xss n;  i \<le> n;  sorted_from i xss \<rbrakk> \<Longrightarrow> sorted_from 0 (radix_sort i xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss))
[PROOF STEP]
proof(induction i arbitrary: xss)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xss. \<lbrakk>cols xss n; 0 \<le> n; sorted (map (drop 0) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort 0 xss))
 2. \<And>i xss. \<lbrakk>\<And>xss. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss)); cols xss n; Suc i \<le> n; sorted (map (drop (Suc i)) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
cols xss n
0 \<le> n
sorted (map (drop 0) xss)

goal (2 subgoals):
 1. \<And>xss. \<lbrakk>cols xss n; 0 \<le> n; sorted (map (drop 0) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort 0 xss))
 2. \<And>i xss. \<lbrakk>\<And>xss. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss)); cols xss n; Suc i \<le> n; sorted (map (drop (Suc i)) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
cols xss n
0 \<le> n
sorted (map (drop 0) xss)

goal (1 subgoal):
 1. sorted (map (drop 0) (radix_sort 0 xss))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (map (drop 0) (radix_sort 0 xss))

goal (1 subgoal):
 1. \<And>i xss. \<lbrakk>\<And>xss. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss)); cols xss n; Suc i \<le> n; sorted (map (drop (Suc i)) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i xss. \<lbrakk>\<And>xss. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss)); cols xss n; Suc i \<le> n; sorted (map (drop (Suc i)) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cols ?xss n; i \<le> n; sorted (map (drop i) ?xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i ?xss))
cols xss n
Suc i \<le> n
sorted (map (drop (Suc i)) xss)

goal (1 subgoal):
 1. \<And>i xss. \<lbrakk>\<And>xss. \<lbrakk>cols xss n; i \<le> n; sorted (map (drop i) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i xss)); cols xss n; Suc i \<le> n; sorted (map (drop (Suc i)) xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cols ?xss n; i \<le> n; sorted (map (drop i) ?xss)\<rbrakk> \<Longrightarrow> sorted (map (drop 0) (radix_sort i ?xss))
cols xss n
Suc i \<le> n
sorted (map (drop (Suc i)) xss)

goal (1 subgoal):
 1. sorted (map (drop 0) (radix_sort (Suc i) xss))
[PROOF STEP]
by(simp add: sorted_from_radix_sort_step cols_sort1)
[PROOF STATE]
proof (state)
this:
sorted (map (drop 0) (radix_sort (Suc i) xss))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_adjoint: assumes lf: "linear (f :: real^'n \<Rightarrow> real ^'m)"
  shows "matrix(adjoint f) = transpose(matrix f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
have "matrix(adjoint f) = matrix(adjoint ((*v) (matrix f)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix (adjoint f) = matrix (adjoint ((*v) (matrix f)))
[PROOF STEP]
by (simp add: lf)
[PROOF STATE]
proof (state)
this:
matrix (adjoint f) = matrix (adjoint ((*v) (matrix f)))

goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix (adjoint f) = matrix (adjoint ((*v) (matrix f)))

goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
have "\<dots> = transpose(matrix f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix (adjoint ((*v) (matrix f))) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
unfolding adjoint_matrix matrix_of_matrix_vector_mul
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (matrix f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
matrix (adjoint ((*v) (matrix f))) = Finite_Cartesian_Product.transpose (matrix f)

goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)

goal (1 subgoal):
 1. matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix (adjoint f) = Finite_Cartesian_Product.transpose (matrix f)

goal:
No subgoals!
[PROOF STEP]
qed