[STATEMENT]
lemma ln_fact_conv_mangoldt: "ln (fact n) = (\<Sum>d=1..n. mangoldt d * floor (n / d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have *: "(\<Sum>da=1..n. if primepow da \<and> da dvd d then ln (aprimedivisor da) else 0) =
             (\<Sum>(da::nat)=1..d. if primepow da \<and> da dvd d then ln (aprimedivisor da) else 0)"
    if d: "d \<in> {1..n}" for d
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.mono_neutral_right, insert d) (auto dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
?d \<in> {1..n} \<Longrightarrow> (\<Sum>da = 1..n. if primepow da \<and> da dvd ?d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..?d. if primepow da \<and> da dvd ?d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. \<Sum>da=1..d. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0) =
      (\<Sum>d=1..n. \<Sum>da=1..n. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.cong) (insert *, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "\<dots> = (\<Sum>da=1..n. \<Sum>d=1..n. if primepow da \<and>
                     da dvd d then ln (aprimedivisor da) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "\<dots> = sum (\<lambda>d. mangoldt d * floor (n/d)) {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
assume d: "d \<in> {1..n}"
[PROOF STATE]
proof (state)
this:
d \<in> {1..n}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) =
            (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)
[PROOF STEP]
by (intro sum.cong) (simp_all add: mangoldt_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = mangoldt d * real (card {x. x \<in> {1..n} \<and> d dvd x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})
[PROOF STEP]
by (subst sum.inter_filter [symmetric]) (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "{x. x \<in> {1..n} \<and> d dvd x} = {x. \<exists>k \<in>{1..n div d}. x=k*d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
assume "x \<in> {1..n}" "d dvd x"
[PROOF STATE]
proof (state)
this:
x \<in> {1..n}
d dvd x

goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
thus "\<exists>k\<in>{1..n div d}. x = k * d"
[PROOF STATE]
proof (prove)
using this:
x \<in> {1..n}
d dvd x

goal (1 subgoal):
 1. \<exists>k\<in>{1..n div d}. x = k * d
[PROOF STEP]
using divisors[of x n d]
[PROOF STATE]
proof (prove)
using this:
x \<in> {1..n}
d dvd x
\<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = d * k

goal (1 subgoal):
 1. \<exists>k\<in>{1..n div d}. x = k * d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>k\<in>{1..n div d}. x = k * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
fix x k
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
assume k: "k \<in> {1..n div d}"
[PROOF STATE]
proof (state)
this:
k \<in> {1..n div d}

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
from k
[PROOF STATE]
proof (chain)
picking this:
k \<in> {1..n div d}
[PROOF STEP]
have "k * d \<le> n div d * d"
[PROOF STATE]
proof (prove)
using this:
k \<in> {1..n div d}

goal (1 subgoal):
 1. k * d \<le> n div d * d
[PROOF STEP]
by (intro mult_right_mono) simp_all
[PROOF STATE]
proof (state)
this:
k * d \<le> n div d * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * d \<le> n div d * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
have "n div d * d \<le> n div d * d + n mod d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div d * d \<le> n div d * d + n mod d
[PROOF STEP]
by (rule le_add1)
[PROOF STATE]
proof (state)
this:
n div d * d \<le> n div d * d + n mod d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n div d * d \<le> n div d * d + n mod d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div d * d + n mod d = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n div d * d + n mod d = n

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
k * d \<le> n
[PROOF STEP]
have "k * d \<le> n"
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n

goal (1 subgoal):
 1. k * d \<le> n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
k * d \<le> n

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
thus "k * d \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n

goal (1 subgoal):
 1. k * d \<in> {1..n}
[PROOF STEP]
using d k
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n
d \<in> {1..n}
k \<in> {1..n div d}

goal (1 subgoal):
 1. k * d \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k * d \<in> {1..n}

goal (1 subgoal):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
{x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = (\<lambda>k. k*d) ` {1..n div d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "card \<dots> = card {1..n div d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}
[PROOF STEP]
by (rule card_image) (simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = n div d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {1..n div d} = n div d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {1..n div d} = n div d

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {1..n div d} = n div d

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "... = \<lfloor>n / d\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n div d) = \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
by (simp add: floor_divide_of_nat_eq)
[PROOF STATE]
proof (state)
this:
int (n div d) = \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (card {x \<in> {1..n}. d dvd x}) = \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
have "real (card {x. x \<in> {1..n} \<and> d dvd x}) = real_of_int \<lfloor>n / d\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
int (card {x \<in> {1..n}. d dvd x}) = \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
show "(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) =
            mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. {1..n} = {1..n}
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. \<Sum>da=1..d. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0) =
    sum (\<lambda>d. mangoldt d * floor (n/d)) {1..n}"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
with ln_primefact
[PROOF STATE]
proof (chain)
picking this:
?n \<noteq> 0 \<Longrightarrow> ln (real ?n) = (\<Sum>d = 1..?n. if primepow d \<and> d dvd ?n then ln (real (aprimedivisor d)) else 0)
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. ln d) =
    (\<Sum>d=1..n. mangoldt d * floor (n/d))"
[PROOF STATE]
proof (prove)
using this:
?n \<noteq> 0 \<Longrightarrow> ln (real ?n) = (\<Sum>d = 1..?n. if primepow d \<and> d dvd ?n then ln (real (aprimedivisor d)) else 0)
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. (\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
with ln_fact
[PROOF STATE]
proof (chain)
picking this:
ln (fact ?n) = (\<Sum>d = 1..?n. ln (real d))
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (fact ?n) = (\<Sum>d = 1..?n. ln (real d))
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pairwise_disjoint_sum:
  "pairwise (\<lambda>s t. disjnt ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
     additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) s)
     ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
     additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) t)) (sumset A A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>s t. disjnt {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t}) (sumset A A)
[PROOF STEP]
unfolding disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>s t. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} \<inter> {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t} = {}) (sumset A A)
[PROOF STEP]
by (intro pairwiseI) (auto)


[STATEMENT]
lemma deriv_pow [simp]:
  shows "Deriv c (A ^^ n) = (if n = 0 then {} else (Deriv c A) @@ (A ^^ (n - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Deriv c (A ^^ n) = (if n = 0 then {} else Deriv c A @@ A ^^ (n - 1))
[PROOF STEP]
apply(induct n arbitrary: A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A. Deriv c (A ^^ 0) = (if 0 = 0 then {} else Deriv c A @@ A ^^ (0 - 1))
 2. \<And>n A. (\<And>A. Deriv c (A ^^ n) = (if n = 0 then {} else Deriv c A @@ A ^^ (n - 1))) \<Longrightarrow> Deriv c (A ^^ Suc n) = (if Suc n = 0 then {} else Deriv c A @@ A ^^ (Suc n - 1))
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n A x. \<lbrakk>\<And>A. Deriv c (A ^^ n) = Deriv c A @@ A ^^ (n - Suc 0); 0 < n; [] \<in> A; x \<in> Deriv c A @@ A ^^ (n - Suc 0)\<rbrakk> \<Longrightarrow> x \<in> Deriv c A @@ A ^^ n
[PROOF STEP]
by (metis Suc_pred concI_if_Nil2 conc_assoc conc_pow_comm lang_pow.simps(2))


[STATEMENT]
lemma vfsequence_vcons_vproductE[elim!]:
  assumes "xs #\<^sub>\<circ> x \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>n. A i)" and "n \<in>\<^sub>\<circ> \<omega>"
  obtains "xs \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>vcard xs. A i)"
    and "x \<in>\<^sub>\<circ> A (vcard xs)"
    and "n = vcard (xs #\<^sub>\<circ> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>xs \<in>\<^sub>\<circ> vproduct (vcard xs) A; x \<in>\<^sub>\<circ> A (vcard xs); n = vcard (xs #\<^sub>\<circ> x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs #\<^sub>\<circ> x \<in>\<^sub>\<circ> vproduct n A
n \<in>\<^sub>\<circ> \<omega>

goal (1 subgoal):
 1. (\<lbrakk>xs \<in>\<^sub>\<circ> vproduct (vcard xs) A; x \<in>\<^sub>\<circ> A (vcard xs); n = vcard (xs #\<^sub>\<circ> x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: vfsequence_vcons_vproductD)


[STATEMENT]
lemma ln_ln_primorial_asymp_equiv [asymp_equiv_intros]:
  "(\<lambda>x. ln (ln (primorial x))) \<sim>[at_top] (\<lambda>x. ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (ln (real (primorial x)))) \<sim>[at_top] ln
[PROOF STEP]
by (auto simp: ln_primorial ln_\<theta>_asymp_equiv)


[STATEMENT]
lemma id_union_univ: "\<Sigma>\<^sub>f \<union> \<C> = UNIV" "\<Sigma> = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range \<Sigma>n) - \<C> \<union> \<C> = UNIV &&& \<Union> (range \<Sigma>n) = UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma fact_Suc [simp]: "fact (Suc n) = of_nat (Suc n) * fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc n) = of_nat (Suc n) * fact n
[PROOF STEP]
by (simp add: fact_prod atLeastAtMostSuc_conv algebra_simps)


[STATEMENT]
lemma last_snd: "xs\<noteq>[] \<Longrightarrow>
  snd(((map (lift P) xs))!(length (map (lift P) xs) - (Suc 0)))=snd(xs!(length xs - (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> snd (map (lift P) xs ! (length (map (lift P) xs) - Suc 0)) = snd (xs ! (length xs - Suc 0))
[PROOF STEP]
by (cases "(xs ! (length xs - (Suc 0)))") (simp_all add:lift_def)


[STATEMENT]
lemma subtrees_insert_union_suc:
  "{x. is_subtree x t} = insert t (\<Union>t1 \<in> fst ` fset (sucs t). {x. is_subtree x t1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. is_subtree x t} = insert t (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})
[PROOF STEP]
using subtrees_insert_union[of "root t" "sucs t"]
[PROOF STATE]
proof (prove)
using this:
{x. is_subtree x (Node (dtree.root t) (sucs t))} = insert (Node (dtree.root t) (sucs t)) (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})

goal (1 subgoal):
 1. {x. is_subtree x t} = insert t (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})
[PROOF STEP]
by simp


[STATEMENT]
lemma push_bit_word_eq_nonzero:
  \<open>push_bit n w \<noteq> 0\<close> if \<open>w < 2 ^ m\<close> \<open>m + n < LENGTH('a)\<close> \<open>w \<noteq> 0\<close>
    for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. push_bit n w \<noteq> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
w < 2 ^ m
m + n < LENGTH('a)
w \<noteq> 0

goal (1 subgoal):
 1. push_bit n w \<noteq> 0
[PROOF STEP]
apply (simp only: word_neq_0_conv word_less_nat_alt
                    mod_0 unat_word_ariths
                    unat_power_lower word_le_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unat w < 2 ^ m; m + n < LENGTH('a); 0 < unat w\<rbrakk> \<Longrightarrow> 0 < unat (push_bit n w)
[PROOF STEP]
apply (metis add_diff_cancel_right' gr0I gr_implies_not0 less_or_eq_imp_le min_def push_bit_eq_0_iff take_bit_nat_eq_self_iff take_bit_push_bit take_bit_take_bit unsigned_push_bit_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_plus_mono2 [intro]: "C \<subseteq> D \<Longrightarrow> E \<subseteq> F \<Longrightarrow> C + E \<subseteq> D + F"
  for C D E F :: "'a::plus set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> D; E \<subseteq> F\<rbrakk> \<Longrightarrow> C + E \<subseteq> D + F
[PROOF STEP]
by (auto simp add: set_plus_def)


[STATEMENT]
lemma finite_nonzero_positions : "finite (nonzero_positions (Rep_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nonzero_positions (Rep_matrix A))
[PROOF STEP]
by (induct A) (simp add: Abs_matrix_inverse matrix_def)


[STATEMENT]
lemma cat_ordinal_Dom_vrange: "\<R>\<^sub>\<circ> (cat_ordinal A\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> cat_ordinal A\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cat_ordinal A\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> cat_ordinal A\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cat_ordinal_components
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<lambda>f\<in>\<^sub>\<circ>ordinal_arrs A. f\<lparr>[]\<^sub>\<circ>\<rparr>) \<subseteq>\<^sub>\<circ> A
[PROOF STEP]
by (intro vrange_VLambda_vsubset, elim ordinal_arrsE) simp


[STATEMENT]
lemma per_classes_dj:
  "\<lbrakk>part_equiv R; (i,j)\<notin>R\<rbrakk> \<Longrightarrow> R``{i} \<inter> R``{j} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>part_equiv R; (i, j) \<notin> R\<rbrakk> \<Longrightarrow> R `` {i} \<inter> R `` {j} = {}
[PROOF STEP]
by (auto dest: part_equiv_trans_sym)


[STATEMENT]
lemma map_us_mono_pres:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
  shows "mono f \<Longrightarrow> mono (map_us f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> mono (map_us f)
[PROOF STEP]
unfolding mono_def map_us_def comp_def us_def IInf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> Abs_upset (\<up> (f (\<Sqinter> Rep_upset x))) \<le> Abs_upset (\<up> (f (\<Sqinter> Rep_upset y)))
[PROOF STEP]
by (metis Abs_upset_inverse Inf_superset_mono less_eq_upset.rep_eq rangeI upset_anti_iff)


[STATEMENT]
lemma Sbis_transC[consumes 3, case_names Match]:
assumes 0: "c \<approx>s d" and "s \<approx> t" and "(c,s) \<rightarrow>c (c',s')"
obtains d' t' where
"(d,t) \<rightarrow>c (d',t')" and "s' \<approx> t'" and "c' \<approx>s d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms Sbis_matchC_C[OF 0]
[PROOF STATE]
proof (prove)
using this:
c \<approx>s d
s \<approx> t
(c, s) \<rightarrow>c (c', s')
matchC_C Sbis c d

goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding matchC_C_def
[PROOF STATE]
proof (prove)
using this:
c \<approx>s d
s \<approx> t
(c, s) \<rightarrow>c (c', s')
\<forall>s t c' s'. s \<approx> t \<and> (c, s) \<rightarrow>c (c', s') \<longrightarrow> (\<exists>d' t'. (d, t) \<rightarrow>c (d', t') \<and> s' \<approx> t' \<and> c' \<approx>s d')

goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma balance_bheight: "bheight l = bheight r \<Longrightarrow> bheight (balance l k v r) = Suc (bheight l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bheight l = bheight r \<Longrightarrow> bheight (balance l k v r) = Suc (bheight l)
[PROOF STEP]
by (induct l k v r rule: balance.induct) auto


[STATEMENT]
lemma multiset_image_do_nothing: "(\<And> x .x \<in># A \<Longrightarrow> f x = x) \<Longrightarrow> image_mset f A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in># A \<Longrightarrow> f x = x) \<Longrightarrow> image_mset f A = A
[PROOF STEP]
by (induct A) auto


[STATEMENT]
lemma set_qsort [simp]: "set (qsort xs l)  = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (qsort xs l) = set xs
[PROOF STEP]
by (simp add: qsort_permutes)


[STATEMENT]
lemma ordertype_eq_Ord [simp]:
  assumes "Ord \<alpha>"
  shows "ordertype (elts \<alpha>) VWF = \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype (elts \<alpha>) VWF = \<alpha>
[PROOF STEP]
using assms ordermap_eq_self [OF assms]
[PROOF STATE]
proof (prove)
using this:
Ord \<alpha>
?x \<in> elts \<alpha> \<Longrightarrow> ordermap (elts \<alpha>) VWF ?x = ?x

goal (1 subgoal):
 1. ordertype (elts \<alpha>) VWF = \<alpha>
[PROOF STEP]
by (simp add: ordertype_def)


[STATEMENT]
lemma starfun_n_add_minus: "( *fn* f) z + -( *fn* g) z = ( *fn* (\<lambda>i x. f i x + -g i x)) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*fn* f) z + - (*fn* g) z = (*fn* (\<lambda>i x. f i x + - g i x)) z
[PROOF STEP]
by (cases z) (simp add: starfun_n star_n_minus star_n_add)


[STATEMENT]
lemma rename_constrains:
     "bij h ==> (rename h F \<in> (h`A) co (h`B)) = (F \<in> A co B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> (rename h F \<in> h ` A co h ` B) = (F \<in> A co B)
[PROOF STEP]
apply (unfold rename_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> (extend (\<lambda>(x, u). h x) F \<in> h ` A co h ` B) = (F \<in> A co B)
[PROOF STEP]
apply (subst extend_set_eq_image [symmetric])+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> (extend (\<lambda>(x, u). h x) F \<in> extend_set (\<lambda>(x, u). h x) A co extend_set (\<lambda>(x, u). h x) B) = (F \<in> A co B)
[PROOF STEP]
apply (erule good_map_bij [THEN Extend.intro, THEN Extend.extend_constrains])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma length_filter_mono[intro]:
  assumes "(\<And> x. P x \<Longrightarrow> Q x)"
  shows "length (filter P xs) \<le> length (filter Q xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
by (induction xs) (auto dest: assms)


[STATEMENT]
lemma continuous_map_pairedI [continuous_intros]:
   "\<lbrakk>continuous_map Z X f; continuous_map Z Y g\<rbrakk> \<Longrightarrow> continuous_map Z (prod_topology X Y) (\<lambda>x. (f x,g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map Z X f; continuous_map Z Y g\<rbrakk> \<Longrightarrow> continuous_map Z (prod_topology X Y) (\<lambda>x. (f x, g x))
[PROOF STEP]
by (simp add: continuous_map_pairwise o_def)


[STATEMENT]
lemma t1_space_closedin_singleton:
   "t1_space X \<longleftrightarrow> (\<forall>x \<in> topspace X. closedin X {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t1_space X = (\<forall>x\<in>topspace X. closedin X {x})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. t1_space X \<Longrightarrow> \<forall>x\<in>topspace X. closedin X {x}
 2. \<forall>x\<in>topspace X. closedin X {x} \<Longrightarrow> t1_space X
[PROOF STEP]
apply (simp add: closedin_contains_derived_set t1_space_derived_set_of_singleton)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>topspace X. closedin X {x} \<Longrightarrow> t1_space X
[PROOF STEP]
using t1_space_alt
[PROOF STATE]
proof (prove)
using this:
t1_space ?X = (\<forall>x\<in>topspace ?X. \<forall>y\<in>topspace ?X. x \<noteq> y \<longrightarrow> (\<exists>U. closedin ?X U \<and> x \<in> U \<and> y \<notin> U))

goal (1 subgoal):
 1. \<forall>x\<in>topspace X. closedin X {x} \<Longrightarrow> t1_space X
[PROOF STEP]
by auto


[STATEMENT]
lemma subst_bexi:
"\<phi> \<in> fmla \<Longrightarrow> t \<in> atrm \<Longrightarrow> t1 \<in> atrm \<Longrightarrow> x \<in> var \<Longrightarrow> y \<in> var \<Longrightarrow> x \<noteq> y \<Longrightarrow> x \<notin> FvarsT t1 \<Longrightarrow>
 subst (bexi x t \<phi>) t1 y = bexi x (substT t t1 y) (subst \<phi> t1 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; t \<in> atrm; t1 \<in> atrm; x \<in> var; y \<in> var; x \<noteq> y; x \<notin> FvarsT t1\<rbrakk> \<Longrightarrow> subst (bexi x t \<phi>) t1 y = bexi x (substT t t1 y) (subst \<phi> t1 y)
[PROOF STEP]
unfolding bexi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; t \<in> atrm; t1 \<in> atrm; x \<in> var; y \<in> var; x \<noteq> y; x \<notin> FvarsT t1\<rbrakk> \<Longrightarrow> subst (exi x (cnj (LLq (Var x) t) \<phi>)) t1 y = exi x (cnj (LLq (Var x) (substT t t1 y)) (subst \<phi> t1 y))
[PROOF STEP]
by simp


[STATEMENT]
lemma ndepth_Push_Node_Inl:
  "ndepth (Push_Node (Inl a) n) = Suc (ndepth n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ndepth (Push_Node (Inl a) n) = Suc (ndepth n)
[PROOF STEP]
using Rep_Node[of n, unfolded Node_def]
[PROOF STATE]
proof (prove)
using this:
Rep_Node n \<in> {p. \<exists>f x k. p = (f, x) \<and> f k = Inr 0}

goal (1 subgoal):
 1. ndepth (Push_Node (Inl a) n) = Suc (ndepth n)
[PROOF STEP]
apply(simp add: ndepth_def Push_Node_def Abs_Node_inverse[OF Node_Push_I[OF Rep_Node]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. (\<exists>x. Rep_Node n = (f, x)) \<and> (\<exists>k. f k = Inr 0) \<Longrightarrow> (case apfst (Old_Datatype.Push (Inl a)) (Rep_Node n) of (f, x) \<Rightarrow> LEAST k. f k = Inr 0) = Suc (case Rep_Node n of (f, x) \<Rightarrow> LEAST k. f k = Inr 0)
[PROOF STEP]
apply(simp add: Push_def split_beta)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. (\<exists>x. Rep_Node n = (f, x)) \<and> (\<exists>k. f k = Inr 0) \<Longrightarrow> (LEAST k. (case k of 0 \<Rightarrow> Inl a | Suc x \<Rightarrow> fst (Rep_Node n) x) = Inr 0) = Suc (LEAST k. fst (Rep_Node n) k = Inr 0)
[PROOF STEP]
apply(rule Least_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>f. (\<exists>x. Rep_Node n = (f, x)) \<and> (\<exists>k. f k = Inr 0) \<Longrightarrow> (case Suc (LEAST k. fst (Rep_Node n) k = Inr 0) of 0 \<Rightarrow> Inl a | Suc x \<Rightarrow> fst (Rep_Node n) x) = Inr 0
 2. \<And>y. \<lbrakk>\<exists>f. (\<exists>x. Rep_Node n = (f, x)) \<and> (\<exists>k. f k = Inr 0); (case y of 0 \<Rightarrow> Inl a | Suc x \<Rightarrow> fst (Rep_Node n) x) = Inr 0\<rbrakk> \<Longrightarrow> Suc (LEAST k. fst (Rep_Node n) k = Inr 0) \<le> y
[PROOF STEP]
apply(auto elim: LeastI intro: ndepth_Push_Node_Inl_aux)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma basis_for_obtain_unique_scalars :
  "basis_for V vs \<Longrightarrow> v \<in> V \<Longrightarrow> \<exists>! as. length as = length vs \<and> v = as \<bullet>\<cdot> vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs; v \<in> V\<rbrakk> \<Longrightarrow> \<exists>!as. length as = length vs \<and> v = as \<bullet>\<cdot> vs
[PROOF STEP]
using lin_independent_obtain_unique_scalars
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?ms \<subseteq> V; R_lin_independent ?ms; ?n \<in> RSpan ?ms\<rbrakk> \<Longrightarrow> \<exists>!rs. set rs \<subseteq> UNIV \<and> length rs = length ?ms \<and> ?n = rs \<bullet>\<cdot> ?ms

goal (1 subgoal):
 1. \<lbrakk>set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs; v \<in> V\<rbrakk> \<Longrightarrow> \<exists>!as. length as = length vs \<and> v = as \<bullet>\<cdot> vs
[PROOF STEP]
by fast


[STATEMENT]
lemma find_remove_None_iff :
  "find_remove P xs = None \<longleftrightarrow> \<not> (\<exists>x . x \<in> set xs \<and> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (find_remove P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x)
[PROOF STEP]
unfolding find_remove.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (find_remove' P xs [] = None) = (\<nexists>x. x \<in> set xs \<and> P x)
[PROOF STEP]
using find_remove'_set(1,2)
        find_remove'_set_rev
[PROOF STATE]
proof (prove)
using this:
find_remove' ?P ?xs ?prev = Some (?x, ?xs') \<Longrightarrow> ?P ?x
find_remove' ?P ?xs ?prev = Some (?x, ?xs') \<Longrightarrow> ?x \<in> set ?xs
\<lbrakk>?x \<in> set ?xs; ?P ?x\<rbrakk> \<Longrightarrow> find_remove' ?P ?xs ?prev \<noteq> None

goal (1 subgoal):
 1. (find_remove' P xs [] = None) = (\<nexists>x. x \<in> set xs \<and> P x)
[PROOF STEP]
by (metis old.prod.exhaust option.exhaust)


[STATEMENT]
lemma 05: \<open>\<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> (s \<rightarrow> q) \<rightarrow> p \<rightarrow> s \<rightarrow> r\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> (s \<rightarrow> q) \<rightarrow> p \<rightarrow> s \<rightarrow> r
[PROOF STEP]
using MP 04 04
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<turnstile> ?p \<rightarrow> ?q; \<turnstile> ?p\<rbrakk> \<Longrightarrow> \<turnstile> ?q
\<turnstile> (((?q \<rightarrow> ?r) \<rightarrow> ?p \<rightarrow> ?r) \<rightarrow> ?s) \<rightarrow> (?p \<rightarrow> ?q) \<rightarrow> ?s
\<turnstile> (((?q \<rightarrow> ?r) \<rightarrow> ?p \<rightarrow> ?r) \<rightarrow> ?s) \<rightarrow> (?p \<rightarrow> ?q) \<rightarrow> ?s

goal (1 subgoal):
 1. \<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> (s \<rightarrow> q) \<rightarrow> p \<rightarrow> s \<rightarrow> r
[PROOF STEP]
.


[STATEMENT]
theorem SubstFormP_Neg: "{SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
obtain k1::name and s1::name and k::name and s::name
    where "atom s1 \<sharp> (v,i,x,x')"        "atom k1 \<sharp> (v,i,x,x',s1)"
          "atom s  \<sharp> (v,i,x,x',k1,s1)"  "atom k  \<sharp> (v,i,x,x',s,k1,s1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s1 k1 s k. \<lbrakk>atom s1 \<sharp> (v, i, x, x'); atom k1 \<sharp> (v, i, x, x', s1); atom s \<sharp> (v, i, x, x', k1, s1); atom k \<sharp> (v, i, x, x', s, k1, s1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom s1 \<sharp> (v, i, x, x')
atom k1 \<sharp> (v, i, x, x', s1)
atom s \<sharp> (v, i, x, x', k1, s1)
atom k \<sharp> (v, i, x, x', s, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom s1 \<sharp> (v, i, x, x')
atom k1 \<sharp> (v, i, x, x', s1)
atom s \<sharp> (v, i, x, x', k1, s1)
atom k \<sharp> (v, i, x, x', s, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
by (force simp: SubstFormP.simps [of s v i "Q_Neg x" _ k] SubstFormP.simps [of s1 v i x x' k1]
               intro: SeqSubstFormP_Neg [THEN cut3])
[PROOF STATE]
proof (state)
this:
{SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invar_drop_first: "\<lbrakk>\<not> is_empty current; invar current\<rbrakk> \<Longrightarrow> invar (drop_first current)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> is_empty current; invar current\<rbrakk> \<Longrightarrow> invar (drop_first current)
[PROOF STEP]
by(induction current rule: pop.induct) auto


[STATEMENT]
lemma end_0smult: "range T \<subseteq> V \<Longrightarrow> 0 \<cdot>\<cdot> T = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range T \<subseteq> V \<Longrightarrow> (0::'f) \<cdot>\<cdot> T = 0
[PROOF STEP]
using zero_smult
[PROOF STATE]
proof (prove)
using this:
?m \<in> V \<Longrightarrow> (0::'f) \<cdot> ?m = (0::'v)

goal (1 subgoal):
 1. range T \<subseteq> V \<Longrightarrow> (0::'f) \<cdot>\<cdot> T = 0
[PROOF STEP]
by fastforce


[STATEMENT]
lemma cross_time_continuous:
  assumes "transversal_segment a b"
  assumes "x \<in> {a<--<b}"
  assumes "e > 0"
  obtains d t where "d > 0" "continuous_on (ball x d) t"
    "\<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}"
    "\<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e"
    "continuous_on (ball x d) t"
    "t x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "x \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
using assms segment_open_subset_closed[of a b]
[PROOF STATE]
proof (prove)
using this:
transversal_segment a b
x \<in> {a<--<b}
0 < e
{a<--<b} \<subseteq> {a--b}

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
by (auto simp: transversal_segment_def)
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transversal_segment a b
x \<in> {a<--<b}
0 < e

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

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define s where "s x = (x - a) \<bullet> rot (b - a)" for x
[PROOF STATE]
proof (state)
this:
s ?x = (?x - a) \<bullet> rev.rot (b - a)

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "s x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s x = 0
[PROOF STEP]
unfolding s_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - a) \<bullet> rev.rot (b - a) = 0
[PROOF STEP]
by (subst in_segment_inner_rot) (auto intro!: assms open_closed_segment)
[PROOF STATE]
proof (state)
this:
s x = 0

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have Ds: "(s has_derivative blinfun_inner_left (rot (b - a))) (at x)"
    (is "(_ has_derivative blinfun_apply (?Ds x)) _")
    for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s has_derivative blinfun_apply (blinfun_inner_left (rev.rot (b - a)))) (at x)
[PROOF STEP]
unfolding s_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (x - a) \<bullet> rev.rot (b - a)) has_derivative blinfun_apply (blinfun_inner_left (rev.rot (b - a)))) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
(s has_derivative blinfun_apply (blinfun_inner_left (rev.rot (b - a)))) (at ?x2)

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have Dsc: "isCont ?Ds x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>c. blinfun_inner_left (rev.rot (b - a))) x
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>c. blinfun_inner_left (rev.rot (b - a))) x

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have nz: "?Ds x (f x) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x) \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transversal_segment a b
x \<in> {a<--<b}
0 < e

goal (1 subgoal):
 1. blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x) \<noteq> 0
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>transversal_segment a b; x \<in> {a<--<b}; 0 < e; f x \<bullet> rev.rot (b - a) = 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
unfolding transversal_segment_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> b \<and> {a--b} \<subseteq> X \<and> (\<forall>z\<in>{a--b}. f z \<bullet> rev.rot (a - b) \<noteq> 0); x \<in> {a<--<b}; 0 < e; f x \<bullet> rev.rot (b - a) = 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (smt inner_minus_left nrm_reverse open_closed_segment)
[PROOF STATE]
proof (state)
this:
blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x) \<noteq> 0

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from flow_implicit_function_at[OF \<open>x \<in> X\<close>, of s, OF \<open>s x = 0\<close> Ds Dsc nz \<open>e > 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
(\<And>u d. \<lbrakk>0 < d; u x = 0; \<And>y. y \<in> cball x d \<Longrightarrow> s (flow0 y (u y)) = 0; \<And>y. y \<in> cball x d \<Longrightarrow> \<bar>u y\<bar> < e; \<And>y. y \<in> cball x d \<Longrightarrow> u y \<in> existence_ivl0 y; continuous_on (cball x d) u; (u has_derivative blinfun_apply (- blinfun_inner_left (rev.rot (b - a)) /\<^sub>R blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x))) (at x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain t d1 where "0 < d1"
    and t0: "t x = 0"
    and d1: "(\<And>y. y \<in> cball x d1 \<Longrightarrow> s (flow0 y (t y)) = 0)"
    "(\<And>y. y \<in> cball x d1 \<Longrightarrow> \<bar>t y\<bar> < e)"
    "(\<And>y. y \<in> cball x d1 \<Longrightarrow> t y \<in> existence_ivl0 y)"
    and tc: "continuous_on (cball x d1) t"
    and t': "(t has_derivative
        (- blinfun_inner_left (rot (b - a)) /\<^sub>R (blinfun_inner_left (rot (b - a))) (f x)))
      (at x)"
[PROOF STATE]
proof (prove)
using this:
(\<And>u d. \<lbrakk>0 < d; u x = 0; \<And>y. y \<in> cball x d \<Longrightarrow> s (flow0 y (u y)) = 0; \<And>y. y \<in> cball x d \<Longrightarrow> \<bar>u y\<bar> < e; \<And>y. y \<in> cball x d \<Longrightarrow> u y \<in> existence_ivl0 y; continuous_on (cball x d) u; (u has_derivative blinfun_apply (- blinfun_inner_left (rev.rot (b - a)) /\<^sub>R blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x))) (at x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>d1 t. \<lbrakk>0 < d1; t x = 0; \<And>y. y \<in> cball x d1 \<Longrightarrow> s (flow0 y (t y)) = 0; \<And>y. y \<in> cball x d1 \<Longrightarrow> \<bar>t y\<bar> < e; \<And>y. y \<in> cball x d1 \<Longrightarrow> t y \<in> existence_ivl0 y; continuous_on (cball x d1) t; (t has_derivative blinfun_apply (- blinfun_inner_left (rev.rot (b - a)) /\<^sub>R blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x))) (at x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < d1
t x = 0
?y2 \<in> cball x d1 \<Longrightarrow> s (flow0 ?y2 (t ?y2)) = 0
?y2 \<in> cball x d1 \<Longrightarrow> \<bar>t ?y2\<bar> < e
?y2 \<in> cball x d1 \<Longrightarrow> t ?y2 \<in> existence_ivl0 ?y2
continuous_on (cball x d1) t
(t has_derivative blinfun_apply (- blinfun_inner_left (rev.rot (b - a)) /\<^sub>R blinfun_apply (blinfun_inner_left (rev.rot (b - a))) (f x))) (at x)

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from tc
[PROOF STATE]
proof (chain)
picking this:
continuous_on (cball x d1) t
[PROOF STEP]
have "t \<midarrow>x\<rightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
continuous_on (cball x d1) t

goal (1 subgoal):
 1. t \<midarrow>x\<rightarrow> 0
[PROOF STEP]
using \<open>0 < d1\<close>
[PROOF STATE]
proof (prove)
using this:
continuous_on (cball x d1) t
0 < d1

goal (1 subgoal):
 1. t \<midarrow>x\<rightarrow> 0
[PROOF STEP]
by (auto simp: continuous_on_def at_within_interior t0 dest!: bspec[where x=x])
[PROOF STATE]
proof (state)
this:
t \<midarrow>x\<rightarrow> 0

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<midarrow>x\<rightarrow> 0
[PROOF STEP]
have ftc: "((\<lambda>y. flow0 y (t y)) \<longlongrightarrow> x) (at x)"
[PROOF STATE]
proof (prove)
using this:
t \<midarrow>x\<rightarrow> 0

goal (1 subgoal):
 1. (\<lambda>y. flow0 y (t y)) \<midarrow>x\<rightarrow> x
[PROOF STEP]
by (auto intro!: tendsto_eq_intros simp: \<open>x \<in> X\<close>)
[PROOF STATE]
proof (state)
this:
(\<lambda>y. flow0 y (t y)) \<midarrow>x\<rightarrow> x

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define e2 where "e2 = min (dist a x) (dist b x)"
[PROOF STATE]
proof (state)
this:
e2 = min (dist a x) (dist b x)

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "e2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transversal_segment a b
x \<in> {a<--<b}
0 < e

goal (1 subgoal):
 1. 0 < e2
[PROOF STEP]
by (auto simp: e2_def open_segment_def)
[PROOF STATE]
proof (state)
this:
0 < e2

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from tendstoD[OF ftc this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F xa in at x. dist (flow0 xa (t xa)) x < e2
[PROOF STEP]
have "\<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F xa in at x. dist (flow0 xa (t xa)) x < e2

goal (1 subgoal):
 1. \<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?S = "{x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "open ?S" "x \<in> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} &&& x \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
using \<open>x \<in> {a<--<b}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> {a<--<b}

goal (1 subgoal):
 1. open {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} &&& x \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
by (auto simp add: open_segment_line_hyperplanes \<open>a \<noteq> b\<close>
        intro!: open_Collect_conj open_halfspace_component_gt open_halfspace_component_lt)
[PROOF STATE]
proof (state)
this:
open {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
x \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from topological_tendstoD[OF ftc this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at x. flow0 x (t x) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
have "\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ?S"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at x. flow0 x (t x) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. \<forall>\<^sub>F y in at x. flow0 y (t y) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
have "\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ball x e2 \<inter> ?S"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F y in at x. dist (flow0 y (t y)) x < e2
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. \<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
by eventually_elim (auto simp: dist_commute)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
obtain d2 where "0 < d2" and "\<And>y. x \<noteq> y \<Longrightarrow> dist y x < d2 \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> ?S"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F y in at x. flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d2. \<lbrakk>0 < d2; \<And>y. \<lbrakk>x \<noteq> y; dist y x < d2\<rbrakk> \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: eventually_at)
[PROOF STATE]
proof (state)
this:
0 < d2
\<lbrakk>x \<noteq> ?y2; dist ?y2 x < d2\<rbrakk> \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < d2
\<lbrakk>x \<noteq> ?y2; dist ?y2 x < d2\<rbrakk> \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
have d2: "dist y x < d2 \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> ?S" for y
[PROOF STATE]
proof (prove)
using this:
0 < d2
\<lbrakk>x \<noteq> ?y2; dist ?y2 x < d2\<rbrakk> \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. dist y x < d2 \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
using \<open>0 < e2\<close> \<open>x \<in> X\<close> t0 \<open>x \<in> ?S\<close>
[PROOF STATE]
proof (prove)
using this:
0 < d2
\<lbrakk>x \<noteq> ?y2; dist ?y2 x < d2\<rbrakk> \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
0 < e2
x \<in> X
t x = 0
x \<in> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. dist y x < d2 \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
[PROOF STEP]
by (cases "y = x") auto
[PROOF STATE]
proof (state)
this:
dist ?y2 x < d2 \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define d where "d = min d1 d2"
[PROOF STATE]
proof (state)
this:
d = min d1 d2

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < d
[PROOF STEP]
using \<open>0 < d1\<close> \<open>0 < d2\<close>
[PROOF STATE]
proof (prove)
using this:
0 < d1
0 < d2

goal (1 subgoal):
 1. 0 < d
[PROOF STEP]
by (simp add: d_def)
[PROOF STATE]
proof (state)
this:
0 < d

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < d

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous_on (ball x d) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (ball x d) t
[PROOF STEP]
by (auto intro!:continuous_on_subset[OF tc] simp add: d_def)
[PROOF STATE]
proof (state)
this:
continuous_on (ball x d) t

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on (ball x d) t

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "ball x e2 \<inter> ?S \<inter> {x. s x = 0} \<subseteq> {a<--<b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0} \<subseteq> {a<--<b}
[PROOF STEP]
by (auto simp add: in_open_segment_iff_rot \<open>a \<noteq> b\<close>) (auto simp: s_def e2_def in_segment)
[PROOF STATE]
proof (state)
this:
ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0} \<subseteq> {a<--<b}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0} \<subseteq> {a<--<b}
[PROOF STEP]
have "\<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}"
[PROOF STATE]
proof (prove)
using this:
ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0} \<subseteq> {a<--<b}

goal (1 subgoal):
 1. \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}
[PROOF STEP]
apply (rule set_mp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0}
[PROOF STEP]
using d1 d2 \<open>0 < d2\<close>
[PROOF STATE]
proof (prove)
using this:
?y2 \<in> cball x d1 \<Longrightarrow> s (flow0 ?y2 (t ?y2)) = 0
?y2 \<in> cball x d1 \<Longrightarrow> \<bar>t ?y2\<bar> < e
?y2 \<in> cball x d1 \<Longrightarrow> t ?y2 \<in> existence_ivl0 ?y2
dist ?y2 x < d2 \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)}
0 < d2

goal (1 subgoal):
 1. \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> ball x e2 \<inter> {x. a \<bullet> (b - a) < x \<bullet> (b - a) \<and> x \<bullet> (b - a) < b \<bullet> (b - a)} \<inter> {x. s x = 0}
[PROOF STEP]
by (auto simp: d_def e2_def dist_commute)
[PROOF STATE]
proof (state)
this:
?y2 \<in> ball x d \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> {a<--<b}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?y2 \<in> ball x d \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> {a<--<b}

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e
[PROOF STEP]
using d1
[PROOF STATE]
proof (prove)
using this:
?y2 \<in> cball x d1 \<Longrightarrow> s (flow0 ?y2 (t ?y2)) = 0
?y2 \<in> cball x d1 \<Longrightarrow> \<bar>t ?y2\<bar> < e
?y2 \<in> cball x d1 \<Longrightarrow> t ?y2 \<in> existence_ivl0 ?y2

goal (1 subgoal):
 1. \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e
[PROOF STEP]
by (auto simp: d_def)
[PROOF STATE]
proof (state)
this:
?y2 \<in> ball x d \<Longrightarrow> \<bar>t ?y2\<bar> < e

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?y2 \<in> ball x d \<Longrightarrow> \<bar>t ?y2\<bar> < e

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous_on (ball x d) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (ball x d) t
[PROOF STEP]
using tc
[PROOF STATE]
proof (prove)
using this:
continuous_on (cball x d1) t

goal (1 subgoal):
 1. continuous_on (ball x d) t
[PROOF STEP]
by (rule continuous_on_subset) (auto simp: d_def)
[PROOF STATE]
proof (state)
this:
continuous_on (ball x d) t

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on (ball x d) t

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "t x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t x = 0
[PROOF STEP]
by (simp add: t0)
[PROOF STATE]
proof (state)
this:
t x = 0

goal (1 subgoal):
 1. (\<And>d t. \<lbrakk>0 < d; continuous_on (ball x d) t; \<And>y. y \<in> ball x d \<Longrightarrow> flow0 y (t y) \<in> {a<--<b}; \<And>y. y \<in> ball x d \<Longrightarrow> \<bar>t y\<bar> < e; continuous_on (ball x d) t; t x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < d
continuous_on (ball x d) t
?y2 \<in> ball x d \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> {a<--<b}
?y2 \<in> ball x d \<Longrightarrow> \<bar>t ?y2\<bar> < e
continuous_on (ball x d) t
t x = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < d
continuous_on (ball x d) t
?y2 \<in> ball x d \<Longrightarrow> flow0 ?y2 (t ?y2) \<in> {a<--<b}
?y2 \<in> ball x d \<Longrightarrow> \<bar>t ?y2\<bar> < e
continuous_on (ball x d) t
t x = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deg_leqI:
  assumes "p \<in> carrier P"
  assumes "\<And>n. n > k \<Longrightarrow> p n = \<zero>"
  shows "degree p \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg R p \<le> k
[PROOF STEP]
by (metis assms(1) assms(2) deg_zero deg_ltrm le0 le_less_linear monom_zero)


[STATEMENT]
theorem k_universal:
  "k_universal k hash (carrier R) (carrier R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k_universal k hash (carrier R) (carrier R)
[PROOF STEP]
using uniform k_wise_indep
[PROOF STATE]
proof (prove)
using this:
?i \<in> carrier R \<Longrightarrow> uniform_on (hash ?i) (carrier R)
k_wise_indep_vars k (\<lambda>_. discrete) hash (carrier R)

goal (1 subgoal):
 1. k_universal k hash (carrier R) (carrier R)
[PROOF STEP]
by (simp add:k_universal_def)


[STATEMENT]
lemma countable_relpow:
  fixes X :: "'a rel"
  assumes Image_X: "\<And>Y. countable Y \<Longrightarrow> countable (X `` Y)"
  assumes Y: "countable Y"
  shows "countable ((X ^^ i) `` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable ((X ^^ i) `` Y)
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
countable Y

goal (1 subgoal):
 1. countable ((X ^^ i) `` Y)
[PROOF STEP]
by (induct i arbitrary: Y) (auto simp: relcomp_Image Image_X)


[STATEMENT]
lemma vcard_0 [simp]: "vcard 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard 0 = 0
[PROOF STEP]
using Card_0 Card_def
[PROOF STATE]
proof (prove)
using this:
Card 0
Card ?i \<equiv> ?i = vcard ?i

goal (1 subgoal):
 1. vcard 0 = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_list_ereal [simp]: "sum_list (map (\<lambda>x. ereal (f x)) xs) = ereal (sum_list (map f xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. ereal (f x)) = ereal (sum_list (map f xs))
[PROOF STEP]
by (induction xs) simp_all


[STATEMENT]
lemma in_mk_uedge_img_iff: "{a,b} \<in> mk_edge ` A \<longleftrightarrow> (a,b) \<in> A \<or> (b,a) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a, b} \<in> mk_edge ` A) = ((a, b) \<in> A \<or> (b, a) \<in> A)
[PROOF STEP]
by (auto simp: doubleton_eq_iff intro: rev_image_eqI)


[STATEMENT]
lemma unat_ucast_up_simp:
  fixes x :: "'a::len word"
  assumes "LENGTH('a) \<le> LENGTH('b)"
  shows "unat (ucast x :: 'b::len word) = unat x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (ucast x) = unat x
[PROOF STEP]
apply (rule bit_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. possible_bit TYPE(nat) n \<Longrightarrow> bit (unat (ucast x)) n = bit (unat x) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
LENGTH('a) \<le> LENGTH('b)

goal (1 subgoal):
 1. \<And>n. possible_bit TYPE(nat) n \<Longrightarrow> bit (unat (ucast x)) n = bit (unat x) n
[PROOF STEP]
apply (auto simp add: bit_simps dest: bit_imp_le_length)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma imgTr10:"\<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H\<rbrakk> \<Longrightarrow> \<one>\<^bsub>G\<^esub> \<in> f ` H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H \<rbrakk> \<Longrightarrow> \<one>\<^bsub>G\<^esub> \<in> f ` H
[PROOF STEP]
apply (frule Group.sg_unit_closed[of "F" "H"], assumption+,
       subst ghom_unit_unit[THEN sym, of "F" "G" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H ; \<one>\<^bsub>F\<^esub> \<in> H\<rbrakk> \<Longrightarrow> f \<one>\<^bsub>F\<^esub> \<in> f ` H
[PROOF STEP]
apply (simp add:image_def, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma connex_dual_semicomplete: "semicomplete {C. connex C r} (\<supseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semicomplete {C. connex C r} (\<lambda>x y. y \<subseteq> x)
[PROOF STEP]
proof (intro completeI, elim CollectE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. \<lbrakk>X \<subseteq> {C. connex C r}; X \<noteq> {}\<rbrakk> \<Longrightarrow> Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. \<lbrakk>X \<subseteq> {C. connex C r}; X \<noteq> {}\<rbrakk> \<Longrightarrow> Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
assume "X \<subseteq> {C. connex C r}" and "X \<noteq> {}"
[PROOF STATE]
proof (state)
this:
X \<subseteq> {C. connex C r}
X \<noteq> {}

goal (1 subgoal):
 1. \<And>X. \<lbrakk>X \<subseteq> {C. connex C r}; X \<noteq> {}\<rbrakk> \<Longrightarrow> Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> {C. connex C r}
X \<noteq> {}
[PROOF STEP]
have "connex (\<Inter>X) r"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> {C. connex C r}
X \<noteq> {}

goal (1 subgoal):
 1. connex (\<Inter> X) r
[PROOF STEP]
by (auto simp: connex_def)
[PROOF STATE]
proof (state)
this:
connex (\<Inter> X) r

goal (1 subgoal):
 1. \<And>X. \<lbrakk>X \<subseteq> {C. connex C r}; X \<noteq> {}\<rbrakk> \<Longrightarrow> Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
connex (\<Inter> X) r
[PROOF STEP]
have "extreme_bound {C. connex C r} (\<supseteq>) X (\<Inter> X)"
[PROOF STATE]
proof (prove)
using this:
connex (\<Inter> X) r

goal (1 subgoal):
 1. greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b} (\<Inter> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b} (\<Inter> X)

goal (1 subgoal):
 1. \<And>X. \<lbrakk>X \<subseteq> {C. connex C r}; X \<noteq> {}\<rbrakk> \<Longrightarrow> Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b} (\<Inter> X)
[PROOF STEP]
show "\<exists>S. extreme_bound {C. connex C r} (\<supseteq>) X S"
[PROOF STATE]
proof (prove)
using this:
greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b} (\<Inter> X)

goal (1 subgoal):
 1. Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ex (greatest {b \<in> {C. connex C r}. bound X (\<lambda>x y. y \<subseteq> x) b})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma B_finite: "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B
[PROOF STEP]
using A B
[PROOF STATE]
proof (prove)
using this:
finite A
B \<subseteq> A
B \<noteq> {}

goal (1 subgoal):
 1. finite B
[PROOF STEP]
by(blast intro: finite_subset)


[STATEMENT]
lemma floor_of_int_eq[simp]: "x \<in> \<int> \<Longrightarrow> of_int \<lfloor>x\<rfloor> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<int> \<Longrightarrow> of_int \<lfloor>x\<rfloor> = x
[PROOF STEP]
by (metis Ints_cases of_int_floor_cancel)


[STATEMENT]
theorem knights_path_exists:
  assumes "min n m \<ge> 5"
  shows "\<exists>ps. knights_path (board n m) ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
5 \<le> min n m

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 5 \<le> min n m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
have "odd n \<or> odd m \<or> even (n*m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd n \<or> odd m \<or> even (n * m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
odd n \<or> odd m \<or> even (n * m)

goal (1 subgoal):
 1. 5 \<le> min n m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd n \<or> odd m \<or> even (n * m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
odd n \<or> odd m \<or> even (n * m)

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
proof (elim disjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. odd n \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 3. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
assume "odd n"
[PROOF STATE]
proof (state)
this:
odd n

goal (3 subgoals):
 1. odd n \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 3. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
using assms knights_path_odd_n_exists
[PROOF STATE]
proof (prove)
using this:
odd n
5 \<le> min n m
\<lbrakk>odd ?n; 5 \<le> min ?n ?m\<rbrakk> \<Longrightarrow> \<exists>ps. knights_path (board ?n ?m) ps \<and> hd ps = (int ?n, 1) \<and> last ps = (int ?n - 1, int ?m - 1)

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ps. knights_path (board n m) ps

goal (2 subgoals):
 1. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
assume "odd m"
[PROOF STATE]
proof (state)
this:
odd m

goal (2 subgoals):
 1. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd m
[PROOF STEP]
obtain ps where "knights_path (board m n) ps"
[PROOF STATE]
proof (prove)
using this:
odd m

goal (1 subgoal):
 1. (\<And>ps. knights_path (board m n) ps \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms knights_path_odd_n_exists
[PROOF STATE]
proof (prove)
using this:
odd m
5 \<le> min n m
\<lbrakk>odd ?n; 5 \<le> min ?n ?m\<rbrakk> \<Longrightarrow> \<exists>ps. knights_path (board ?n ?m) ps \<and> hd ps = (int ?n, 1) \<and> last ps = (int ?n - 1, int ?m - 1)

goal (1 subgoal):
 1. (\<And>ps. knights_path (board m n) ps \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
knights_path (board m n) ps

goal (2 subgoals):
 1. odd m \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
 2. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
knights_path (board m n) ps
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
knights_path (board m n) ps

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
using transpose_knights_path
[PROOF STATE]
proof (prove)
using this:
knights_path (board m n) ps
knights_path (board ?n ?m) ?ps \<Longrightarrow> knights_path (board ?m ?n) (KnightsTour.transpose ?ps)

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ps. knights_path (board n m) ps

goal (1 subgoal):
 1. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
assume "even (n*m)"
[PROOF STATE]
proof (state)
this:
even (n * m)

goal (1 subgoal):
 1. even (n * m) \<Longrightarrow> \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even (n * m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
even (n * m)

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
using assms knights_circuit_exists
[PROOF STATE]
proof (prove)
using this:
even (n * m)
5 \<le> min n m
\<lbrakk>5 \<le> min ?n ?m; even (?n * ?m)\<rbrakk> \<Longrightarrow> \<exists>ps. knights_circuit (board ?n ?m) ps

goal (1 subgoal):
 1. \<exists>ps. knights_path (board n m) ps
[PROOF STEP]
by (auto simp: knights_circuit_def)
[PROOF STATE]
proof (state)
this:
\<exists>ps. knights_path (board n m) ps

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>ps. knights_path (board n m) ps

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LeadsTo_Un:
     "[| F \<in> A LeadsTo C; F \<in> B LeadsTo C |] ==> F \<in> (A \<union> B) LeadsTo C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto>w C; F \<in> B \<longmapsto>w C\<rbrakk> \<Longrightarrow> F \<in> A \<union> B \<longmapsto>w C
[PROOF STEP]
using LeadsTo_UN [of "{A, B}" F id C]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> {A, B} \<Longrightarrow> F \<in> id i \<longmapsto>w C) \<Longrightarrow> F \<in> \<Union> (id ` {A, B}) \<longmapsto>w C

goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto>w C; F \<in> B \<longmapsto>w C\<rbrakk> \<Longrightarrow> F \<in> A \<union> B \<longmapsto>w C
[PROOF STEP]
by auto


[STATEMENT]
lemma lm024:
  assumes "f \<circ> g = id"
  shows "inj_on g UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<circ> g = id

goal (1 subgoal):
 1. inj g
[PROOF STEP]
by (metis inj_on_id inj_on_imageI2)


[STATEMENT]
lemma subcringE:
  assumes "subcring H R"
  shows "H \<subseteq> carrier R"
    and "\<zero>\<^bsub>R\<^esub> \<in> H"
    and "\<one>\<^bsub>R\<^esub> \<in> H"
    and "H \<noteq> {}"
    and "\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = h2 \<otimes>\<^bsub>R\<^esub> h1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((H \<subseteq> carrier R &&& \<zero>\<^bsub>R\<^esub> \<in> H) &&& \<one>\<^bsub>R\<^esub> \<in> H &&& H \<noteq> {}) &&& ((\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H)) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = h2 \<otimes>\<^bsub>R\<^esub> h1)
[PROOF STEP]
using subringE[OF subcring.axioms(1)[OF assms]] subcring.sub_m_comm[OF assms]
[PROOF STATE]
proof (prove)
using this:
H \<subseteq> carrier R
\<zero>\<^bsub>R\<^esub> \<in> H
\<one>\<^bsub>R\<^esub> \<in> H
H \<noteq> {}
?h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> ?h \<in> H
\<lbrakk>?h1.0 \<in> H; ?h2.0 \<in> H\<rbrakk> \<Longrightarrow> ?h1.0 \<otimes>\<^bsub>R\<^esub> ?h2.0 \<in> H
\<lbrakk>?h1.0 \<in> H; ?h2.0 \<in> H\<rbrakk> \<Longrightarrow> ?h1.0 \<oplus>\<^bsub>R\<^esub> ?h2.0 \<in> H
\<lbrakk>?h1.0 \<in> H; ?h2.0 \<in> H\<rbrakk> \<Longrightarrow> ?h1.0 \<otimes>\<^bsub>R\<^esub> ?h2.0 = ?h2.0 \<otimes>\<^bsub>R\<^esub> ?h1.0

goal (1 subgoal):
 1. ((H \<subseteq> carrier R &&& \<zero>\<^bsub>R\<^esub> \<in> H) &&& \<one>\<^bsub>R\<^esub> \<in> H &&& H \<noteq> {}) &&& ((\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H)) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = h2 \<otimes>\<^bsub>R\<^esub> h1)
[PROOF STEP]
by simp+


[STATEMENT]
lemma HInfinite_HFinite_iff: "x \<in> HInfinite \<longleftrightarrow> x \<notin> HFinite"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> HInfinite) = (x \<notin> HFinite)
[PROOF STEP]
by (blast dest: HFinite_not_HInfinite not_HFinite_HInfinite)


[STATEMENT]
lemma pp_total_linorder_matrix_1:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  assumes "\<ominus>(f \<odot> mtop) = mbot"
    shows "\<exists>j . f (i,j) \<noteq> bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>j. f (i, j) \<noteq> bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>j. f (i, j) \<noteq> bot
[PROOF STEP]
have "\<not>(\<exists>j . f (i,j) \<noteq> bot) \<Longrightarrow> \<ominus>(f \<odot> mtop) \<noteq> mbot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
assume "\<not>(\<exists>j . f (i,j) \<noteq> bot)"
[PROOF STATE]
proof (state)
this:
\<nexists>j. f (i, j) \<noteq> bot

goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
hence "top = -(f \<odot> mtop) (i,i)"
[PROOF STATE]
proof (prove)
using this:
\<nexists>j. f (i, j) \<noteq> bot

goal (1 subgoal):
 1. top = - (f \<odot> mtop) (i, i)
[PROOF STEP]
by (simp add: comp_top_linorder_matrix linorder_finite_sup_selective)
[PROOF STATE]
proof (state)
this:
top = - (f \<odot> mtop) (i, i)

goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
top = - (f \<odot> mtop) (i, i)

goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
have "... = (\<ominus>(f \<odot> mtop)) (i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (f \<odot> mtop) (i, i) = (\<ominus> (f \<odot> mtop)) (i, i)
[PROOF STEP]
by (simp add: uminus_matrix_def)
[PROOF STATE]
proof (state)
this:
- (f \<odot> mtop) (i, i) = (\<ominus> (f \<odot> mtop)) (i, i)

goal (1 subgoal):
 1. \<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
top = (\<ominus> (f \<odot> mtop)) (i, i)
[PROOF STEP]
show "\<ominus>(f \<odot> mtop) \<noteq> mbot"
[PROOF STATE]
proof (prove)
using this:
top = (\<ominus> (f \<odot> mtop)) (i, i)

goal (1 subgoal):
 1. \<ominus> (f \<odot> mtop) \<noteq> mbot
[PROOF STEP]
by (metis bot_matrix_def bot_not_top)
[PROOF STATE]
proof (state)
this:
\<ominus> (f \<odot> mtop) \<noteq> mbot

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot

goal (1 subgoal):
 1. \<exists>j. f (i, j) \<noteq> bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot

goal (1 subgoal):
 1. \<exists>j. f (i, j) \<noteq> bot
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<nexists>j. f (i, j) \<noteq> bot \<Longrightarrow> \<ominus> (f \<odot> mtop) \<noteq> mbot
matrix_p_algebra.dense (f \<odot> mtop)

goal (1 subgoal):
 1. \<exists>j. f (i, j) \<noteq> bot
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>j. f (i, j) \<noteq> bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_equal: "\<forall>x. x \<noteq> a \<longrightarrow> f x = g x \<Longrightarrow> (f \<midarrow>a\<rightarrow> l) \<longleftrightarrow> (g \<midarrow>a\<rightarrow> l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<noteq> a \<longrightarrow> f x = g x \<Longrightarrow> f \<midarrow>a\<rightarrow> l = g \<midarrow>a\<rightarrow> l
[PROOF STEP]
by (simp add: tendsto_def eventually_at_topological)


[STATEMENT]
lemma inext_less_mono_fin: "
  \<lbrakk> a < b; a \<in> I; b \<in> I; finite I; b \<noteq> Max I \<rbrakk> \<Longrightarrow> inext a I < inext b I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; a \<in> I; b \<in> I; finite I; b \<noteq> Max I\<rbrakk> \<Longrightarrow> inext a I < inext b I
[PROOF STEP]
by (blast intro: inext_less_mono Max_in)


[STATEMENT]
lemma all_disjx_conv[simp]:
    "(\<forall>x. x \<or> P x) \<longleftrightarrow> P False"
    "(\<forall>x. x \<or> P (\<not>x)) \<longleftrightarrow> P True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. x \<or> P x) = P False &&& (\<forall>x. x \<or> P (\<not> x)) = P True
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<forall>x. x \<or> P x \<Longrightarrow> P False
 2. \<And>x. \<lbrakk>P False; \<not> P x\<rbrakk> \<Longrightarrow> x
 3. \<forall>x. x \<or> P (\<not> x) \<Longrightarrow> P True
 4. \<And>x. \<lbrakk>P True; \<not> P (\<not> x)\<rbrakk> \<Longrightarrow> x
[PROOF STEP]
apply (drule spec[where x=False], simp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>P False; \<not> P x\<rbrakk> \<Longrightarrow> x
 2. \<forall>x. x \<or> P (\<not> x) \<Longrightarrow> P True
 3. \<And>x. \<lbrakk>P True; \<not> P (\<not> x)\<rbrakk> \<Longrightarrow> x
[PROOF STEP]
apply (case_tac x, auto) []
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. x \<or> P (\<not> x) \<Longrightarrow> P True
 2. \<And>x. \<lbrakk>P True; \<not> P (\<not> x)\<rbrakk> \<Longrightarrow> x
[PROOF STEP]
apply (drule spec[where x=False], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>P True; \<not> P (\<not> x)\<rbrakk> \<Longrightarrow> x
[PROOF STEP]
apply (case_tac x, auto) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sublist_rev_right: "sublist xs (rev ys) = sublist (rev xs) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sublist xs (rev ys) = sublist (rev xs) ys
[PROOF STEP]
by (subst sublist_rev [symmetric]) (simp only: rev_rev_ident)


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

goal (1 subgoal):
 1. cross_ratio (of_complex x) 0\<^sub>h (of_complex y) \<infinity>\<^sub>h = of_complex (x / y)
[PROOF STEP]
by (transfer, transfer) (simp, rule_tac x="-1/y" in exI, simp)


[STATEMENT]
lemma Fake_parts_insert:
     "X \<in> synth (analz H) \<Longrightarrow>
      parts (insert X H) \<subseteq> synth (analz H) \<union> parts H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> synth (analz H) \<Longrightarrow> parts (insert X H) \<subseteq> synth (analz H) \<union> parts H
[PROOF STEP]
by (metis Un_commute analz_increasing insert_subset parts_analz parts_mono
          parts_synth synth_mono synth_subset_iff)