[STATEMENT]
lemma length_findnth:
  "length (findnth n) = 4 * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (findnth n) = 4 * n
[PROOF STEP]
by (induct n, auto)


[STATEMENT]
lemma coeff_Bernstein_sum_01: fixes b::"nat \<Rightarrow> real" assumes hi: "p \<ge> i"
  shows
    "coeff (reciprocal_poly p
            (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:])
      (p - i) = (p choose i) * (b i)" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
define P where "P \<equiv> (\<Sum>x = 0..p. (smult (b x) (Bernstein_Poly_01 x p)))"
[PROOF STATE]
proof (state)
this:
P \<equiv> \<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
have "\<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
show "degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
apply (cases "x \<le> p")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<le> p \<Longrightarrow> degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
 2. \<not> x \<le> p \<Longrightarrow> degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
by (auto simp: degree_Bernstein coeff_gt)
[PROOF STATE]
proof (state)
this:
degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (smult (b ?x) (Bernstein_Poly_01 ?x p)) \<le> p

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
hence "reciprocal_poly p P =
         (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)))"
[PROOF STATE]
proof (prove)
using this:
degree (smult (b ?x) (Bernstein_Poly_01 ?x p)) \<le> p

goal (1 subgoal):
 1. reciprocal_poly p P = (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)))
[PROOF STEP]
apply (subst P_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p) \<Longrightarrow> reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) = (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)))
[PROOF STEP]
apply (rule reciprocal_sum)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<And>x. degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p) \<Longrightarrow> degree (smult (b x) (Bernstein_Poly_01 x p)) \<le> p
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P = (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P = (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
have
    "... = (\<Sum>x = 0..p. (smult (b x * (p choose x)) ([:-1, 1:]^(p-x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p))) = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))
[PROOF STEP]
assume "x \<in> {0..p}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..p}

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))
[PROOF STEP]
hence "x \<le> p"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..p}

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

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))
[PROOF STEP]
thus "reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) =
          smult ((b x) * (p choose x)) ([:-1, 1:]^(p-x))"
[PROOF STATE]
proof (prove)
using this:
x \<le> p

goal (1 subgoal):
 1. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))
[PROOF STEP]
by (auto simp add: reciprocal_smult degree_Bernstein Bernstein_reciprocal)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p)) = smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x))

goal (1 subgoal):
 1. {0..p} = {0..p}
[PROOF STEP]
qed (simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x = 0..p. reciprocal_poly p (smult (b x) (Bernstein_Poly_01 x p))) = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
reciprocal_poly p P = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))
[PROOF STEP]
have
    "reciprocal_poly p P =
     (\<Sum>x = 0..p. (smult ((b x) * (p choose x)) ([:-1, 1:]^(p-x))))"
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p P = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))

goal (1 subgoal):
 1. reciprocal_poly p P = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
hence
    "(reciprocal_poly p P) \<circ>\<^sub>p [:1, 1:] =
     (\<Sum>x = 0..p. (smult ((b x) * (p choose x)) ([:-1, 1:]^(p-x))) \<circ>\<^sub>p [:1, 1:])"
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p P = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)))

goal (1 subgoal):
 1. reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:])
[PROOF STEP]
by (simp add: pcompose_sum pcompose_add)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:])

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:])

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
have "... = (\<Sum>x = 0..p. (monom ((b x) * (p choose x)) (p - x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:]) = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)
[PROOF STEP]
assume "x \<in> {0..p}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..p}

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)
[PROOF STEP]
hence "x \<le> p"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..p}

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

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)
[PROOF STEP]
thus "smult (b x * (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] =
          monom (b x * (p choose x)) (p - x)"
[PROOF STATE]
proof (prove)
using this:
x \<le> p

goal (1 subgoal):
 1. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)
[PROOF STEP]
by (simp add: hom_distribs pcompose_smult pcompose_pCons monom_altdef)
[PROOF STATE]
proof (state)
this:
smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:] = monom (b x * real (p choose x)) (p - x)

goal (1 subgoal):
 1. {0..p} = {0..p}
[PROOF STEP]
qed (simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x = 0..p. smult (b x * real (p choose x)) ([:- 1, 1:] ^ (p - x)) \<circ>\<^sub>p [:1, 1:]) = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))
[PROOF STEP]
have "(reciprocal_poly p P) \<circ>\<^sub>p [:1, 1:] =
                (\<Sum>x = 0..p. (monom ((b x) * (p choose x)) (p - x)))"
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))

goal (1 subgoal):
 1. reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
hence "?L = (\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0)"
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p P \<circ>\<^sub>p [:1, 1:] = (\<Sum>x = 0..p. monom (b x * real (p choose x)) (p - x))

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = (\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0)
[PROOF STEP]
by (auto simp add: P_def coeff_sum)
[PROOF STATE]
proof (state)
this:
coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = (\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0)

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = (\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0)

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
have "... = (\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0) = (\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
assume "x \<in> {0..p}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..p}

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
hence "x \<le> p"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..p}

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

goal (2 subgoals):
 1. {0..p} = {0..p}
 2. \<And>x. x \<in> {0..p} \<Longrightarrow> (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
thus "(if p - x = p - i then b x * real (p choose x) else 0) =
          (if x = i then b x * real (p choose x) else 0)"
[PROOF STATE]
proof (prove)
using this:
x \<le> p

goal (1 subgoal):
 1. (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
using hi
[PROOF STATE]
proof (prove)
using this:
x \<le> p
i \<le> p

goal (1 subgoal):
 1. (if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)
[PROOF STEP]
by (auto simp add: leI)
[PROOF STATE]
proof (state)
this:
(if p - x = p - i then b x * real (p choose x) else 0) = (if x = i then b x * real (p choose x) else 0)

goal (1 subgoal):
 1. {0..p} = {0..p}
[PROOF STEP]
qed (simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0) = (\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0)

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x = 0..p. if p - x = p - i then b x * real (p choose x) else 0) = (\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0)

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
have "... = ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0) = real (p choose i) * b i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x = 0..p. if x = i then b x * real (p choose x) else 0) = real (p choose i) * b i

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i

goal (1 subgoal):
 1. coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coeff (reciprocal_poly p (\<Sum>x = 0..p. smult (b x) (Bernstein_Poly_01 x p)) \<circ>\<^sub>p [:1, 1:]) (p - i) = real (p choose i) * b i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_eq_full:
  shows "dim S = dimension \<longleftrightarrow> span S = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dim S = dimension) = (span S = UNIV)
[PROOF STEP]
by (metis dim_eq_span dim_subset_UNIV span_Basis span_span subset_UNIV
        dim_UNIV dim_span dimension_def)


[STATEMENT]
lemma wf_tuple_drop: "wf_tuple (b + n) A xs \<Longrightarrow> {x - b | x. x \<in> A \<and> x \<ge> b} = B \<Longrightarrow>
  wf_tuple n B (drop b xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_tuple (b + n) A xs; {x - b |x. x \<in> A \<and> b \<le> x} = B\<rbrakk> \<Longrightarrow> wf_tuple n B (drop b xs)
[PROOF STEP]
unfolding wf_tuple_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = b + n \<and> (\<forall>i<b + n. (xs ! i = None) = (i \<notin> A)); {x - b |x. x \<in> A \<and> b \<le> x} = B\<rbrakk> \<Longrightarrow> length (drop b xs) = n \<and> (\<forall>i<n. (drop b xs ! i = None) = (i \<notin> B))
[PROOF STEP]
by force


[STATEMENT]
lemma uminus_pow_Numeral1: "(-(x::_::monoid_mult)) ^ Numeral1 = -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x) ^ Numeral1 = - x
[PROOF STEP]
by simp


[STATEMENT]
lemma SUP_mult_left_ennreal: "c * (SUP i\<in>I. f i) = (SUP i\<in>I. c * f i ::ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * Sup (f ` I) = (SUP i\<in>I. c * f i)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup (f ` I) = (SUP i\<in>I. c * f i)
 2. \<not> ?P \<Longrightarrow> c * Sup (f ` I) = (SUP i\<in>I. c * f i)
[PROOF STEP]
assume "I \<noteq> {}"
[PROOF STATE]
proof (state)
this:
I \<noteq> {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup (f ` I) = (SUP i\<in>I. c * f i)
 2. \<not> ?P \<Longrightarrow> c * Sup (f ` I) = (SUP i\<in>I. c * f i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
I \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
I \<noteq> {}

goal (1 subgoal):
 1. c * Sup (f ` I) = (SUP i\<in>I. c * f i)
[PROOF STEP]
by transfer (auto simp add: SUP_ereal_mult_left max_absorb2 SUP_upper2)
[PROOF STATE]
proof (state)
this:
c * Sup (f ` I) = (SUP i\<in>I. c * f i)

goal (1 subgoal):
 1. \<not> I \<noteq> {} \<Longrightarrow> c * Sup (f ` I) = (SUP i\<in>I. c * f i)
[PROOF STEP]
qed (simp add: bot_ennreal)


[STATEMENT]
lemma Legendre_0_eq_0[simp]: "Legendre 0 p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Legendre 0 p = 0
[PROOF STEP]
unfolding Legendre_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if [0 = 0] (mod p) then 0 else if QuadRes p 0 then 1 else - 1) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma fact_mono_nat: "m \<le> n \<Longrightarrow> fact m \<le> (fact n :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> fact m \<le> fact n
[PROOF STEP]
by (induct n) (auto simp: le_Suc_eq)


[STATEMENT]
lemma has_derivative_transform_at:
  assumes "0 < d"
    and "\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'"
    and "(f has_derivative f') (at x)"
  shows "(g has_derivative f') (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative f') (at x)
[PROOF STEP]
using has_derivative_transform_within [of d x UNIV f g f'] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < d; x \<in> UNIV; \<forall>x'\<in>UNIV. dist x' x < d \<longrightarrow> f x' = g x'; (f has_derivative f') (at x)\<rbrakk> \<Longrightarrow> (g has_derivative f') (at x)
0 < d
\<forall>x'. dist x' x < d \<longrightarrow> f x' = g x'
(f has_derivative f') (at x)

goal (1 subgoal):
 1. (g has_derivative f') (at x)
[PROOF STEP]
by simp


[STATEMENT]
lemma roots0: assumes p: "p \<noteq> 0" and p0: "degree p = 0"
  shows "{x. poly p x = 0} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = (0::'a)} = {}
[PROOF STEP]
using degree0_coeffs[OF p0] p
[PROOF STATE]
proof (prove)
using this:
\<exists>a. p = [:a:]
p \<noteq> 0

goal (1 subgoal):
 1. {x. poly p x = (0::'a)} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma set_minimize_wrt:
  assumes "\<And>x y. Q x y \<Longrightarrow> \<not> Q y x"
    and "sorted_wrt Q xs"
    and "\<And>x y. \<not> P x y \<Longrightarrow> Q x y"
    and "\<And>x. P x x"
  shows "set (minimize_wrt P xs) = {x \<in> set xs. \<forall>y\<in>set xs. P y x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (minimize_wrt P xs) = {x \<in> set xs. \<forall>y\<in>set xs. P y x}
[PROOF STEP]
by (auto simp: in_minimize_wrt_iff [OF assms])


[STATEMENT]
lemma decseq_SucI: "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X
[PROOF STEP]
using order.lift_Suc_mono_le[OF dual_order, of X]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>n. X (Suc n) \<le> X n; ?n \<le> ?n'\<rbrakk> \<Longrightarrow> X ?n' \<le> X ?n

goal (1 subgoal):
 1. (\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X
[PROOF STEP]
by (auto simp: decseq_def)


[STATEMENT]
lemma continuous_on_generated_topo_iff:
  "continuous_map T1 (topology_generated_by S) f \<longleftrightarrow>
      ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1))) \<and> (f`(topspace T1) \<subseteq> (\<Union> S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map T1 (topology_generated_by S) f = ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)) \<and> f ` topspace T1 \<subseteq> \<Union> S)
[PROOF STEP]
unfolding continuous_map_alt topology_generated_by_topspace
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>U. openin (topology_generated_by S) U \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)) \<and> f ` topspace T1 \<subseteq> \<Union> S) = ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)) \<and> f ` topspace T1 \<subseteq> \<Union> S)
[PROOF STEP]
proof (auto simp add: topology_generated_by_Basis)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1); f ` topspace T1 \<subseteq> \<Union> S; openin (topology_generated_by S) U\<rbrakk> \<Longrightarrow> openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
assume H: "\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)"
[PROOF STATE]
proof (state)
this:
\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1); f ` topspace T1 \<subseteq> \<Union> S; openin (topology_generated_by S) U\<rbrakk> \<Longrightarrow> openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
fix U
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1); f ` topspace T1 \<subseteq> \<Union> S; openin (topology_generated_by S) U\<rbrakk> \<Longrightarrow> openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
assume "openin (topology_generated_by S) U"
[PROOF STATE]
proof (state)
this:
openin (topology_generated_by S) U

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1); f ` topspace T1 \<subseteq> \<Union> S; openin (topology_generated_by S) U\<rbrakk> \<Longrightarrow> openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
openin (topology_generated_by S) U
[PROOF STEP]
have "generate_topology_on S U"
[PROOF STATE]
proof (prove)
using this:
openin (topology_generated_by S) U

goal (1 subgoal):
 1. generate_topology_on S U
[PROOF STEP]
by (rule openin_topology_generated_by)
[PROOF STATE]
proof (state)
this:
generate_topology_on S U

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1); f ` topspace T1 \<subseteq> \<Union> S; openin (topology_generated_by S) U\<rbrakk> \<Longrightarrow> openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generate_topology_on S U
[PROOF STEP]
show "openin T1 (f -` U \<inter> topspace T1)"
[PROOF STATE]
proof (prove)
using this:
generate_topology_on S U

goal (1 subgoal):
 1. openin T1 (f -` U \<inter> topspace T1)
[PROOF STEP]
proof (induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>a b. \<lbrakk>generate_topology_on S a; openin T1 (f -` a \<inter> topspace T1); generate_topology_on S b; openin T1 (f -` b \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
 3. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 4. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>a b. \<lbrakk>generate_topology_on S a; openin T1 (f -` a \<inter> topspace T1); generate_topology_on S b; openin T1 (f -` b \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
 3. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 4. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
assume H: "openin T1 (f -` a \<inter> topspace T1)" "openin T1 (f -` b \<inter> topspace T1)"
[PROOF STATE]
proof (state)
this:
openin T1 (f -` a \<inter> topspace T1)
openin T1 (f -` b \<inter> topspace T1)

goal (4 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>a b. \<lbrakk>generate_topology_on S a; openin T1 (f -` a \<inter> topspace T1); generate_topology_on S b; openin T1 (f -` b \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
 3. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 4. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
have "f -` (a \<inter> b) \<inter> topspace T1 = (f-`a \<inter> topspace T1) \<inter> (f-`b \<inter> topspace T1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` (a \<inter> b) \<inter> topspace T1 = f -` a \<inter> topspace T1 \<inter> (f -` b \<inter> topspace T1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f -` (a \<inter> b) \<inter> topspace T1 = f -` a \<inter> topspace T1 \<inter> (f -` b \<inter> topspace T1)

goal (4 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>a b. \<lbrakk>generate_topology_on S a; openin T1 (f -` a \<inter> topspace T1); generate_topology_on S b; openin T1 (f -` b \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
 3. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 4. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f -` (a \<inter> b) \<inter> topspace T1 = f -` a \<inter> topspace T1 \<inter> (f -` b \<inter> topspace T1)
[PROOF STEP]
show "openin T1 (f -` (a \<inter> b) \<inter> topspace T1)"
[PROOF STATE]
proof (prove)
using this:
f -` (a \<inter> b) \<inter> topspace T1 = f -` a \<inter> topspace T1 \<inter> (f -` b \<inter> topspace T1)

goal (1 subgoal):
 1. openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
f -` (a \<inter> b) \<inter> topspace T1 = f -` a \<inter> topspace T1 \<inter> (f -` b \<inter> topspace T1)
openin T1 (f -` a \<inter> topspace T1)
openin T1 (f -` b \<inter> topspace T1)

goal (1 subgoal):
 1. openin T1 (f -` (a \<inter> b) \<inter> topspace T1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
openin T1 (f -` (a \<inter> b) \<inter> topspace T1)

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
fix K
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
assume H: "openin T1 (f -` k \<inter> topspace T1)" if "k\<in> K" for k
[PROOF STATE]
proof (state)
this:
?k \<in> K \<Longrightarrow> openin T1 (f -` ?k \<inter> topspace T1)

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
define L where "L = {f -` k \<inter> topspace T1|k. k \<in> K}"
[PROOF STATE]
proof (state)
this:
L = {f -` k \<inter> topspace T1 |k. k \<in> K}

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
have *: "openin T1 l" if "l \<in>L" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin T1 l
[PROOF STEP]
using that H
[PROOF STATE]
proof (prove)
using this:
l \<in> L
?k \<in> K \<Longrightarrow> openin T1 (f -` ?k \<inter> topspace T1)

goal (1 subgoal):
 1. openin T1 l
[PROOF STEP]
unfolding L_def
[PROOF STATE]
proof (prove)
using this:
l \<in> {f -` k \<inter> topspace T1 |k. k \<in> K}
?k \<in> K \<Longrightarrow> openin T1 (f -` ?k \<inter> topspace T1)

goal (1 subgoal):
 1. openin T1 l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?l \<in> L \<Longrightarrow> openin T1 ?l

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
have "openin T1 (\<Union>L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin T1 (\<Union> L)
[PROOF STEP]
using openin_Union[OF *]
[PROOF STATE]
proof (prove)
using this:
(\<And>S. S \<in> ?K \<Longrightarrow> S \<in> L) \<Longrightarrow> openin T1 (\<Union> ?K)

goal (1 subgoal):
 1. openin T1 (\<Union> L)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
openin T1 (\<Union> L)

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
openin T1 (\<Union> L)

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
have "(\<Union>L) = (f -` \<Union>K \<inter> topspace T1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> L = f -` \<Union> K \<inter> topspace T1
[PROOF STEP]
unfolding L_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {f -` k \<inter> topspace T1 |k. k \<in> K} = f -` \<Union> K \<inter> topspace T1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> L = f -` \<Union> K \<inter> topspace T1

goal (3 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>K. \<lbrakk>\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k; \<And>k. k \<in> K \<Longrightarrow> openin T1 (f -` k \<inter> topspace T1)\<rbrakk> \<Longrightarrow> openin T1 (f -` \<Union> K \<inter> topspace T1)
 3. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
openin T1 (\<Union> L)
\<Union> L = f -` \<Union> K \<inter> topspace T1
[PROOF STEP]
show "openin T1 (f -` \<Union>K \<inter> topspace T1)"
[PROOF STATE]
proof (prove)
using this:
openin T1 (\<Union> L)
\<Union> L = f -` \<Union> K \<inter> topspace T1

goal (1 subgoal):
 1. openin T1 (f -` \<Union> K \<inter> topspace T1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
openin T1 (f -` \<Union> K \<inter> topspace T1)

goal (2 subgoals):
 1. openin T1 (f -` {} \<inter> topspace T1)
 2. \<And>s. s \<in> S \<Longrightarrow> openin T1 (f -` s \<inter> topspace T1)
[PROOF STEP]
qed (auto simp add: H)
[PROOF STATE]
proof (state)
this:
openin T1 (f -` U \<inter> topspace T1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in semiring_of_sets) generated_ring_INTER:
  "finite I \<Longrightarrow> I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring) \<Longrightarrow> \<Inter>(A ` I) \<in> generated_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; \<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring\<rbrakk> \<Longrightarrow> \<Inter> (A ` I) \<in> generated_ring
[PROOF STEP]
by (intro generated_ring_Inter) auto


[STATEMENT]
lemma VLambda_set_def: "(\<lambda>a\<in>\<^sub>\<circ>A. f a) = set {\<langle>a, f a\<rangle> | a. a \<in>\<^sub>\<circ> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VLambda A f = set {\<langle>a, f a\<rangle> |a. a \<in>\<^sub>\<circ> A}
[PROOF STEP]
by auto


[STATEMENT]
lemma carrier_singles[simp]:
  "carrier (singles S) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (singles S) = UNIV
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<Union> (set ` {xs. \<forall>x\<in>S. length (filter (\<lambda>x'. x' = x) xs) \<le> 1}) = UNIV
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S x. \<exists>xa. (\<forall>x\<in>S. length (filter (\<lambda>x'. x' = x) xa) \<le> Suc 0) \<and> x \<in> set xa
[PROOF STEP]
apply (rule_tac x = "[x]" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S x. (\<forall>xa\<in>S. length (filter (\<lambda>x'. x' = xa) [x]) \<le> Suc 0) \<and> x \<in> set [x]
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma openin_open_subtopology:
     "openin X S \<Longrightarrow> openin (subtopology X S) T \<longleftrightarrow> openin X T \<and> T \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin X S \<Longrightarrow> openin (subtopology X S) T = (openin X T \<and> T \<subseteq> S)
[PROOF STEP]
by (metis inf.orderE openin_Int openin_imp_subset openin_subtopology)


[STATEMENT]
lemma real_arch_invD:
  "0 < (e::real) \<Longrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e
[PROOF STEP]
by (subst(asm) real_arch_inverse)


[STATEMENT]
lemma in_incs:
  assumes "(ys, t) \<in> set (incs a x (xs, s))"
  shows "length ys = length xs + 1 \<and> t = s + hd ys * a \<and> tl ys = xs \<and> cond ys t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length xs + 1 \<and> t = s + hd ys * a \<and> tl ys = xs \<and> cond ys t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(ys, t) \<in> set (incs a x (xs, s))

goal (1 subgoal):
 1. length ys = length xs + 1 \<and> t = s + hd ys * a \<and> tl ys = xs \<and> cond ys t
[PROOF STEP]
by (induct a x "(xs, s)" arbitrary: ys t rule: incs.induct)
    (subst (asm) (2) incs.simps, auto simp: Let_def)


[STATEMENT]
lemma subset_imp_gcard_le:
  assumes "A \<subseteq> B" "small B"
  shows "gcard A \<le> gcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard A \<le> gcard B
[PROOF STEP]
by (simp add: assms lepoll_imp_gcard_le subset_imp_lepoll)


[STATEMENT]
lemma Abs_ffilter: "(ffilter f s = s') = ({e \<in> (fset s). f e} = (fset s'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ffilter f s = s') = ({e \<in> fset s. f e} = fset s')
[PROOF STEP]
by (simp add: ffilter_def fset_both_sides Abs_fset_inverse Set.filter_def)


[STATEMENT]
lemma function_tuple_eval_closed:
  assumes "is_function_tuple R n fs"
  assumes "x \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)
[PROOF STEP]
apply(rule cartesian_power_car_memI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (function_tuple_eval R n fs x) = length fs
 2. \<And>i. i < length fs \<Longrightarrow> function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
apply (metis function_tuple_eval_def length_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
assume "i < length fs"
[PROOF STATE]
proof (state)
this:
i < length fs

goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length fs
[PROOF STEP]
show "function_tuple_eval R n fs x ! i \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
i < length fs

goal (1 subgoal):
 1. function_tuple_eval R n fs x ! i \<in> carrier R
[PROOF STEP]
unfolding function_tuple_eval_def
[PROOF STATE]
proof (prove)
using this:
i < length fs

goal (1 subgoal):
 1. map (\<lambda>f. f x) fs ! i \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < length fs
is_function_tuple R n fs
x \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. map (\<lambda>f. f x) fs ! i \<in> carrier R
[PROOF STEP]
unfolding is_function_tuple_def
[PROOF STATE]
proof (prove)
using this:
i < length fs
set fs \<subseteq> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
x \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. map (\<lambda>f. f x) fs ! i \<in> carrier R
[PROOF STEP]
by (metis funcset_carrier nth_map nth_mem subsetD)
[PROOF STATE]
proof (state)
this:
function_tuple_eval R n fs x ! i \<in> carrier R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_image_advance: "\<lbrakk>q\<in>R\<^sup>* `` Q0; (q,x)\<in>R\<rbrakk> \<Longrightarrow> x\<in>R\<^sup>* `` Q0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q \<in> R\<^sup>* `` Q0; (q, x) \<in> R\<rbrakk> \<Longrightarrow> x \<in> R\<^sup>* `` Q0
[PROOF STEP]
by (auto intro: rtrancl_into_rtrancl)


[STATEMENT]
lemma floor_less_neg_numeral [simp]: "\<lfloor>x\<rfloor> < - numeral v \<longleftrightarrow> x < - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < - numeral v) = (x < - numeral v)
[PROOF STEP]
by (simp add: floor_less_iff)


[STATEMENT]
lemma ennreal_minus_eq_top[simp]: "a - (b::ennreal) = top \<longleftrightarrow> a = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b = top) = (a = top)
[PROOF STEP]
by (metis add_top diff_add_cancel_ennreal ennreal_mono_minus ennreal_top_minus zero_le)


[STATEMENT]
lemma lemFromToTo:
    shows "(from p to q) \<oplus> (from q to r) = (from p to r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from p to q \<oplus> from q to r = from p to r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. from p to q \<oplus> from q to r = from p to r
[PROOF STEP]
have shared: "\<forall>valp valq valr.( valq - valp + (valr - valq) = valr - valp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>valp valq valr. valq - valp + (valr - valq) = valr - valp
[PROOF STEP]
by (metis add_uminus_conv_diff add_diff_cancel
                semiring_normalization_rules(24) semiring_normalization_rules(25))
[PROOF STATE]
proof (state)
this:
\<forall>valp valq valr. valq - valp + (valr - valq) = valr - valp

goal (1 subgoal):
 1. from p to q \<oplus> from q to r = from p to r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>valp valq valr. valq - valp + (valr - valq) = valr - valp

goal (1 subgoal):
 1. from p to q \<oplus> from q to r = from p to r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
from p to q \<oplus> from q to r = from p to r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alist_of_Abs_pq:
  assumes "distinct (map fst xs)"
    and "sorted (map snd xs)"
  shows "alist_of (Abs_pq xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alist_of (Abs_pq xs) = xs
[PROOF STEP]
by (rule Abs_pq_inverse) (simp add: assms)


[STATEMENT]
lemma take_columns_transpose_matrix: "take_columns (transpose_matrix A) n = transpose_matrix (take_rows A n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_columns (transpose_matrix A) n = transpose_matrix (take_rows A n)
[PROOF STEP]
apply (simp add: Rep_matrix_inject[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (take_columns (transpose_matrix A) n) = Rep_matrix (transpose_matrix (take_rows A n))
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (take_columns (transpose_matrix A) n) x xa = Rep_matrix (transpose_matrix (take_rows A n)) x xa
[PROOF STEP]
by simp


[STATEMENT]
lemma moebius_ocircline_opposite_ocircline [simp]:
  shows "moebius_ocircline M (opposite_ocircline H) = opposite_ocircline (moebius_ocircline M H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_ocircline M (opposite_ocircline H) = opposite_ocircline (moebius_ocircline M H)
[PROOF STEP]
by (transfer, transfer, simp, rule_tac x=1 in exI, simp)


[STATEMENT]
lemma dim_row_space_iarray[code_unfold]:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  shows "vec.dim (row_space A) = rank_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (row_space A) = rank_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding row_rank_def[symmetric] rank_def[symmetric] matrix_to_iarray_rank
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_iarray (matrix_to_iarray A) = rank_iarray (matrix_to_iarray A)
[PROOF STEP]
..


[STATEMENT]
lemma convergent_powser'_ln:
  "convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))
[PROOF STEP]
have "(\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream)n * x ^ n) sums ln (1 + x)"
    if "abs x < 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < 1
[PROOF STEP]
have "(\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
by (rule ln_series')
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
have "(\<lambda>n. - ((- x) ^ n) / real n) =
                 (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) = (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n)
[PROOF STEP]
by (auto simp: fun_eq_iff mssnth_ln_series_stream power_mult_distrib [symmetric])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- x) ^ n) / real n) = (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * ?x ^ n) sums ln (1 + ?x)

goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * ?x ^ n) sums ln (1 + ?x)

goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))
[PROOF STEP]
unfolding convergent_powser'_def
[PROOF STATE]
proof (prove)
using this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * ?x ^ n) sums ln (1 + ?x)

goal (1 subgoal):
 1. \<exists>R>0. \<forall>x. \<bar>x\<bar> < R \<longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream ln_series_stream) n * x ^ n) sums ln (1 + x)
[PROOF STEP]
by (force intro!: exI[of _ 1])
[PROOF STATE]
proof (state)
this:
convergent_powser' (msllist_of_msstream ln_series_stream) (\<lambda>x. ln (1 + x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subgraph_preserves_hom:
  assumes "subgraph A B"
          "graph_homomorphism X A h"
  shows "graph_homomorphism X B h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_homomorphism X B h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subgraph A B
graph_homomorphism X A h

goal (1 subgoal):
 1. graph_homomorphism X B h
[PROOF STEP]
by (meson graph_homomorphism_def2 map_graph_preserves_restricted subgraph_def subgraph_trans)


[STATEMENT]
lemma "rec_list nil cons (x#xs) = cons x xs (rec_list nil cons xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_list nil cons (x # xs) = cons x xs (rec_list nil cons xs)
[PROOF STEP]
nitpick [card = 1-5, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_list nil cons (x # xs) = cons x xs (rec_list nil cons xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in residues) res_pow_eq: "x [^] (n::nat) = x ^ n mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] n = x ^ n mod m
[PROOF STEP]
using m_gt_one
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. x [^] n = x ^ n mod m
[PROOF STEP]
by (induct n)
    (simp_all add: res_one_eq res_mult_eq mult_ac mod_mult_right_eq)


[STATEMENT]
lemma suminf_split_head: "summable f \<Longrightarrow> (\<Sum>n. f (Suc n)) = suminf f - f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. f (Suc n)) = suminf f - f 0
[PROOF STEP]
using suminf_split_initial_segment[of 1]
[PROOF STATE]
proof (prove)
using this:
summable f \<Longrightarrow> suminf f = (\<Sum>n. f (n + 1)) + sum f {..<1}

goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. f (Suc n)) = suminf f - f 0
[PROOF STEP]
by simp


[STATEMENT]
lemma SN_s_mul_ext_strong:
  assumes "order_pair s ns"
    and "\<forall>y. y \<in># M \<longrightarrow> SN_on s {y}"
  shows "SN_on (s_mul_ext ns s) {M}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_on (s_mul_ext ns s) {M}
[PROOF STEP]
using mult2_s_eq_mult2_s_alt[of "ns\<inverse>" "s\<inverse>"] assms wf_below_pointwise[of "s\<inverse>" "set_mset M"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ns\<inverse> O s\<inverse> \<subseteq> s\<inverse>; refl (ns\<inverse>); trans (s\<inverse>)\<rbrakk> \<Longrightarrow> mult2_alt_s (ns\<inverse>) (s\<inverse>) = mult2_s (ns\<inverse>) (s\<inverse>)
order_pair s ns
\<forall>y. y \<in># M \<longrightarrow> SN_on s {y}
wf_below (s\<inverse>) (set_mset M) = (\<forall>a. a \<in># M \<longrightarrow> wf_below (s\<inverse>) {a})

goal (1 subgoal):
 1. SN_on (s_mul_ext ns s) {M}
[PROOF STEP]
unfolding SN_on_iff_wf_below s_mul_ext_def order_pair_def compat_pair_def pre_order_pair_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ns\<inverse> O s\<inverse> \<subseteq> s\<inverse>; refl (ns\<inverse>); trans (s\<inverse>)\<rbrakk> \<Longrightarrow> mult2_alt_s (ns\<inverse>) (s\<inverse>) = mult2_s (ns\<inverse>) (s\<inverse>)
(refl ns \<and> trans s \<and> trans ns) \<and> ns O s \<subseteq> s \<and> s O ns \<subseteq> s
\<forall>y. y \<in># M \<longrightarrow> wf_below (s\<inverse>) {y}
wf_below (s\<inverse>) (set_mset M) = (\<forall>a. a \<in># M \<longrightarrow> wf_below (s\<inverse>) {a})

goal (1 subgoal):
 1. wf_below (((mult2_alt_s (ns\<inverse>) (s\<inverse>))\<inverse>)\<inverse>) {M}
[PROOF STEP]
by (auto intro!: wf_below_mult2_s_local simp: converse_relcomp[symmetric])


[STATEMENT]
lemma measure_space_eq:
  assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a"
  shows "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'
[PROOF STEP]
interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra \<Omega> (sigma_sets \<Omega> A)
[PROOF STEP]
using closed
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> Pow \<Omega>

goal (1 subgoal):
 1. sigma_algebra \<Omega> (sigma_sets \<Omega> A)
[PROOF STEP]
by (rule sigma_algebra_sigma_sets)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'
[PROOF STEP]
from positive_cong_eq[OF eq, of "\<lambda>i. i"] countably_additive_eq[OF eq, of "\<lambda>i. i"]
[PROOF STATE]
proof (chain)
picking this:
(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> a \<in> sigma_sets \<Omega> A) \<Longrightarrow> positive (sigma_sets \<Omega> A) \<mu> = positive (sigma_sets \<Omega> A) \<mu>'
(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> a \<in> sigma_sets \<Omega> A) \<Longrightarrow> countably_additive (sigma_sets \<Omega> A) \<mu> = countably_additive (sigma_sets \<Omega> A) \<mu>'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> a \<in> sigma_sets \<Omega> A) \<Longrightarrow> positive (sigma_sets \<Omega> A) \<mu> = positive (sigma_sets \<Omega> A) \<mu>'
(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> a \<in> sigma_sets \<Omega> A) \<Longrightarrow> countably_additive (sigma_sets \<Omega> A) \<mu> = countably_additive (sigma_sets \<Omega> A) \<mu>'

goal (1 subgoal):
 1. measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'
[PROOF STEP]
by (auto simp: measure_space_def)
[PROOF STATE]
proof (state)
this:
measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma squarefree_decompose: "\<Prod>(squarefree_part n) * square_part n ^ 2 = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
define A s where "A = squarefree_part n" and "s = square_part n"
[PROOF STATE]
proof (state)
this:
A = squarefree_part n
s = square_part n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
have "(\<Prod>A) = (\<Prod>p\<in>A. p ^ (multiplicity p n mod 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>A = (\<Prod>p\<in>A. p ^ (multiplicity p n mod 2))
[PROOF STEP]
by (intro prod.cong) (auto simp: A_def squarefree_part_def elim!: oddE)
[PROOF STATE]
proof (state)
this:
\<Prod>A = (\<Prod>p\<in>A. p ^ (multiplicity p n mod 2))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Prod>A = (\<Prod>p\<in>A. p ^ (multiplicity p n mod 2))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>A. p ^ (multiplicity p n mod 2)) = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2))
[PROOF STEP]
by (intro prod.mono_neutral_left) (auto simp: A_def  squarefree_part_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>A. p ^ (multiplicity p n mod 2)) = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>A. p ^ (multiplicity p n mod 2)) = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
have "\<dots> * s^2 = n"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2)) * s\<^sup>2 = n
[PROOF STEP]
by (simp add: s_def square_part_def prod.distrib [symmetric] power_add [symmetric]
                  power_mult [symmetric] prime_factorization_nat [symmetric] algebra_simps
                  prod_power_distrib)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n mod 2)) * s\<^sup>2 = n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
 2. n \<noteq> 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Prod>A * s\<^sup>2 = n
[PROOF STEP]
show "\<Prod>A * s^2 = n"
[PROOF STATE]
proof (prove)
using this:
\<Prod>A * s\<^sup>2 = n

goal (1 subgoal):
 1. \<Prod>A * s\<^sup>2 = n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Prod>A * s\<^sup>2 = n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> \<Prod>(squarefree_part n) * (square_part n)\<^sup>2 = n
[PROOF STEP]
qed simp


[STATEMENT]
lemma ce_rel_lm_22: "r \<in> ce_rels \<Longrightarrow> \<exists> p \<in> PrimRec3. r = { (x,y). \<exists> u. p x y u = 0 }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> ce_rels \<Longrightarrow> \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<in> ce_rels \<Longrightarrow> \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
assume r_ce: "r \<in> ce_rels"
[PROOF STATE]
proof (state)
this:
r \<in> ce_rels

goal (1 subgoal):
 1. r \<in> ce_rels \<Longrightarrow> \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r \<in> ce_rels
[PROOF STEP]
have "\<exists> p \<in> PrimRec3. \<forall> x y. ((x,y) \<in> r) = (\<exists> u. p x y u = 0)"
[PROOF STATE]
proof (prove)
using this:
r \<in> ce_rels

goal (1 subgoal):
 1. \<exists>p\<in>PrimRec3. \<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)
[PROOF STEP]
by (rule ce_rel_lm_21)
[PROOF STATE]
proof (state)
this:
\<exists>p\<in>PrimRec3. \<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)

goal (1 subgoal):
 1. r \<in> ce_rels \<Longrightarrow> \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>p\<in>PrimRec3. \<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)
[PROOF STEP]
obtain p where p_is_pr: "p \<in> PrimRec3" and L1: "\<forall> x y. ((x,y) \<in> r) = (\<exists> u. p x y u = 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>p\<in>PrimRec3. \<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p \<in> PrimRec3; \<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<in> PrimRec3
\<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)

goal (1 subgoal):
 1. r \<in> ce_rels \<Longrightarrow> \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
from p_is_pr L1
[PROOF STATE]
proof (chain)
picking this:
p \<in> PrimRec3
\<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<in> PrimRec3
\<forall>x y. ((x, y) \<in> r) = (\<exists>u. p x y u = 0)

goal (1 subgoal):
 1. \<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>p\<in>PrimRec3. r = {(x, y). \<exists>u. p x y u = 0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bijective_reverse:
  assumes "bijective p"
      and "bijective q"
    shows "p \<le> r * q \<longleftrightarrow> q \<le> r\<^sup>T * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
have "p \<le> r * q \<longleftrightarrow> p * q\<^sup>T \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<le> r * q) = (p * q\<^sup>T \<le> r)
[PROOF STEP]
by (simp add: assms(2) shunt_bijective)
[PROOF STATE]
proof (state)
this:
(p \<le> r * q) = (p * q\<^sup>T \<le> r)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p \<le> r * q) = (p * q\<^sup>T \<le> r)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
have "... \<longleftrightarrow> q\<^sup>T \<le> p\<^sup>T * r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p * q\<^sup>T \<le> r) = (q\<^sup>T \<le> p\<^sup>T * r)
[PROOF STEP]
by (metis assms(1) conv_dist_comp conv_involutive conv_order shunt_bijective)
[PROOF STATE]
proof (state)
this:
(p * q\<^sup>T \<le> r) = (q\<^sup>T \<le> p\<^sup>T * r)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p * q\<^sup>T \<le> r) = (q\<^sup>T \<le> p\<^sup>T * r)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
have "... \<longleftrightarrow> q \<le> r\<^sup>T * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q\<^sup>T \<le> p\<^sup>T * r) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
using conv_dist_comp conv_isotone
[PROOF STATE]
proof (prove)
using this:
(?x * ?y)\<^sup>T = ?y\<^sup>T * ?x\<^sup>T
?x \<le> ?y \<Longrightarrow> ?x\<^sup>T \<le> ?y\<^sup>T

goal (1 subgoal):
 1. (q\<^sup>T \<le> p\<^sup>T * r) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(q\<^sup>T \<le> p\<^sup>T * r) = (q \<le> r\<^sup>T * p)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(p \<le> r * q) = (q \<le> r\<^sup>T * p)

goal (1 subgoal):
 1. (p \<le> r * q) = (q \<le> r\<^sup>T * p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p \<le> r * q) = (q \<le> r\<^sup>T * p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_tree23_of_list: "T_tree23_of_list as \<le> 3*(length as) + 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_tree23_of_list as \<le> 3 * length as + 4
[PROOF STEP]
using T_join_all[of "leaves as"]
[PROOF STATE]
proof (prove)
using this:
T_join_all (leaves as) \<le> 2 * len (leaves as)

goal (1 subgoal):
 1. T_tree23_of_list as \<le> 3 * length as + 4
[PROOF STEP]
by(simp add: T_tree23_of_list_def T_leaves len_leaves)


[STATEMENT]
lemma empty_mult[simp]: "({#},N) \<in> mult R \<longleftrightarrow> N \<noteq> {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (({#}, N) \<in> mult R) = (N \<noteq> {#})
[PROOF STEP]
using empty_mulex_on[of N UNIV "\<lambda>M N. (M,N) \<in> R"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>N \<noteq> {#}; N \<in> multisets UNIV\<rbrakk> \<Longrightarrow> mulex (\<lambda>M N. (M, N) \<in> R) {#} N

goal (1 subgoal):
 1. (({#}, N) \<in> mult R) = (N \<noteq> {#})
[PROOF STEP]
by (auto simp add: mulex_iff_mult)


[STATEMENT]
lemma Sum_any_zeroI: "(\<And>x. f x = 0) \<Longrightarrow> Sum_any f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. f x = (0::'b)) \<Longrightarrow> Sum_any f = (0::'b)
[PROOF STEP]
by (auto simp: Sum_any.expand_set)


[STATEMENT]
lemma allAllocationsFinite:
  assumes "finite N" "finite G"
  shows "finite (allAllocations N G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (allAllocations N G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (allAllocations N G)
[PROOF STEP]
have "finite (Pow(N\<times>(Pow G-{{}})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Pow (N \<times> (Pow G - {{}})))
[PROOF STEP]
using assms finite_Pow_iff
[PROOF STATE]
proof (prove)
using this:
finite N
finite G
finite (Pow ?A) = finite ?A

goal (1 subgoal):
 1. finite (Pow (N \<times> (Pow G - {{}})))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (Pow (N \<times> (Pow G - {{}})))

goal (1 subgoal):
 1. finite (allAllocations N G)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (Pow (N \<times> (Pow G - {{}})))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (Pow (N \<times> (Pow G - {{}})))

goal (1 subgoal):
 1. finite (allAllocations N G)
[PROOF STEP]
using lm052 rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
finite (Pow (N \<times> (Pow G - {{}})))
allAllocations ?N ?G \<subseteq> Pow (?N \<times> (Pow ?G - {{}}))
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite (allAllocations N G)
[PROOF STEP]
by (metis(no_types))
[PROOF STATE]
proof (state)
this:
finite (allAllocations N G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma supplement2_Legendre':
  assumes "prime p" "p \<noteq> 2"
  shows "Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
p \<noteq> 2
[PROOF STEP]
have "p > 2"
[PROOF STATE]
proof (prove)
using this:
prime p
p \<noteq> 2

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
using prime_gt_1_int[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
p \<noteq> 2
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 < p

goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 < p

goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
from this and assms
[PROOF STATE]
proof (chain)
picking this:
2 < p
prime p
p \<noteq> 2
[PROOF STEP]
have "odd p"
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p
p \<noteq> 2

goal (1 subgoal):
 1. odd p
[PROOF STEP]
by (auto simp: prime_odd_int)
[PROOF STATE]
proof (state)
this:
odd p

goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 < p
odd p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 < p
odd p

goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
using supplement2_Jacobi'[of p] assms prime_odd_int[of p]
[PROOF STATE]
proof (prove)
using this:
2 < p
odd p
\<lbrakk>odd p; 1 < p\<rbrakk> \<Longrightarrow> Jacobi 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
prime p
p \<noteq> 2
\<lbrakk>prime p; 2 < p\<rbrakk> \<Longrightarrow> odd p

goal (1 subgoal):
 1. Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)
[PROOF STEP]
by (simp add: prime_p_Jacobi_eq_Legendre)
[PROOF STATE]
proof (state)
this:
Legendre 2 p = (if p mod 8 = 1 \<or> p mod 8 = 7 then 1 else - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UnderS_AboveS_Galois:
"\<lbrakk>B \<le> Field r; C \<le> Field r\<rbrakk> \<Longrightarrow> (B \<le> AboveS r C) = (C \<le> UnderS r B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> Field r; C \<subseteq> Field r\<rbrakk> \<Longrightarrow> (B \<subseteq> AboveS r C) = (C \<subseteq> UnderS r B)
[PROOF STEP]
by(unfold AboveS_def UnderS_def, blast)


[STATEMENT]
lemma poincare_collinear_zero_iff:
  assumes "of_complex y' \<in> unit_disc" and "of_complex z' \<in> unit_disc" and
          "y' \<noteq> z'" and "y' \<noteq> 0" and "z' \<noteq> 0"
  shows "poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<longleftrightarrow>
         y'*cnj z' = cnj y'*z'" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} = (y' * cnj z' = cnj y' * z')
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} = (y' * cnj z' = cnj y' * z')
[PROOF STEP]
have "of_complex y' \<noteq> of_complex z'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex y' \<noteq> of_complex z'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0

goal (1 subgoal):
 1. of_complex y' \<noteq> of_complex z'
[PROOF STEP]
using of_complex_inj
[PROOF STATE]
proof (prove)
using this:
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex ?x = of_complex ?y \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. of_complex y' \<noteq> of_complex z'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} = (y' * cnj z' = cnj y' * z')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} = (y' * cnj z' = cnj y' * z')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}

goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
hence "0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))"
[PROOF STATE]
proof (prove)
using this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}

goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
[PROOF STEP]
using unique_poincare_line[of "of_complex y'" "of_complex z'"]
[PROOF STATE]
proof (prove)
using this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
\<lbrakk>of_complex y' \<noteq> of_complex z'; of_complex y' \<in> unit_disc; of_complex z' \<in> unit_disc; of_complex y' \<in> circline_set ?l; of_complex z' \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line (of_complex y') (of_complex z')

goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
[PROOF STEP]
using assms \<open>of_complex y' \<noteq> of_complex z'\<close>
[PROOF STATE]
proof (prove)
using this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
\<lbrakk>of_complex y' \<noteq> of_complex z'; of_complex y' \<in> unit_disc; of_complex z' \<in> unit_disc; of_complex y' \<in> circline_set ?l; of_complex z' \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line (of_complex y') (of_complex z')
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
\<exists>p. is_poincare_line p \<and> {0\<^sub>h, of_complex y', of_complex z'} \<subseteq> circline_set p
\<lbrakk>of_complex y' \<noteq> of_complex z'; of_complex y' \<in> unit_disc; of_complex z' \<in> unit_disc; of_complex y' \<in> circline_set ?l; of_complex z' \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line (of_complex y') (of_complex z')
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))

goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))

goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
let ?mix = "y' * cnj z' - cnj y' * z'"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
have "is_real (\<i> * ?mix)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_real (\<i> * (y' * cnj z' - cnj y' * z'))
[PROOF STEP]
using eq_cnj_iff_real[of ?mix]
[PROOF STATE]
proof (prove)
using this:
(cnj (y' * cnj z' - cnj y' * z') = y' * cnj z' - cnj y' * z') = is_real (y' * cnj z' - cnj y' * z')

goal (1 subgoal):
 1. is_real (\<i> * (y' * cnj z' - cnj y' * z'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_real (\<i> * (y' * cnj z' - cnj y' * z'))

goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
hence "y' * cnj z' = cnj y' * z' \<longleftrightarrow> Re (\<i> * ?mix) = 0"
[PROOF STATE]
proof (prove)
using this:
is_real (\<i> * (y' * cnj z' - cnj y' * z'))

goal (1 subgoal):
 1. (y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))
[PROOF STEP]
using complex.expand[of "\<i> * ?mix" 0]
[PROOF STATE]
proof (prove)
using this:
is_real (\<i> * (y' * cnj z' - cnj y' * z'))
Re (\<i> * (y' * cnj z' - cnj y' * z')) = Re 0 \<and> Im (\<i> * (y' * cnj z' - cnj y' * z')) = Im 0 \<Longrightarrow> \<i> * (y' * cnj z' - cnj y' * z') = 0

goal (1 subgoal):
 1. (y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))
[PROOF STEP]
by (metis complex_i_not_zero eq_iff_diff_eq_0 mult_eq_0_iff zero_complex.simps(1) zero_complex.simps(2))
[PROOF STATE]
proof (state)
this:
(y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))

goal (2 subgoals):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} \<Longrightarrow> y' * cnj z' = cnj y' * z'
 2. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
(y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
(y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))

goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z'
[PROOF STEP]
using \<open>y' \<noteq> z'\<close> \<open>y' \<noteq> 0\<close> \<open>z' \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex y') (of_complex z'))
(y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0

goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z'
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
0\<^sub>h \<in> Collect (on_circline (poincare_line (of_complex y') (of_complex z')))
(y' * cnj z' = cnj y' * z') = is_imag (\<i> * (y' * cnj z' - cnj y' * z'))
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0

goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z'
[PROOF STEP]
by simp (transfer, transfer, auto simp add: vec_cnj_def split: if_split_asm, metis Re_complex_of_real Re_mult_real Im_complex_of_real)
[PROOF STATE]
proof (state)
this:
y' * cnj z' = cnj y' * z'

goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
y' * cnj z' = cnj y' * z'

goal (1 subgoal):
 1. y' * cnj z' = cnj y' * z' \<Longrightarrow> poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
thus ?lhs
[PROOF STATE]
proof (prove)
using this:
y' * cnj z' = cnj y' * z'

goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
using assms \<open>of_complex y' \<noteq> of_complex z'\<close>
[PROOF STATE]
proof (prove)
using this:
y' * cnj z' = cnj y' * z'
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
y' * cnj z' = cnj y' * z'
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. \<exists>p. is_poincare_line p \<and> {0\<^sub>h, of_complex y', of_complex z'} \<subseteq> circline_set p
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
y' * cnj z' = cnj y' * z'
of_complex y' \<in> unit_disc
of_complex z' \<in> unit_disc
y' \<noteq> z'
y' \<noteq> 0
z' \<noteq> 0
of_complex y' \<noteq> of_complex z'

goal (1 subgoal):
 1. \<exists>p. is_poincare_line p \<and> {0\<^sub>h, of_complex y', of_complex z'} \<subseteq> Collect (on_circline p)
[PROOF STEP]
apply (rule_tac x="poincare_line (of_complex y') (of_complex z')" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y' * cnj z' = cnj y' * z'; of_complex y' \<in> unit_disc; of_complex z' \<in> unit_disc; y' \<noteq> z'; y' \<noteq> 0; z' \<noteq> 0; of_complex y' \<noteq> of_complex z'\<rbrakk> \<Longrightarrow> is_poincare_line (poincare_line (of_complex y') (of_complex z')) \<and> {0\<^sub>h, of_complex y', of_complex z'} \<subseteq> Collect (on_circline (poincare_line (of_complex y') (of_complex z')))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y' * cnj z' = cnj y' * z'; cmod y' < 1; cmod z' < 1; y' \<noteq> z'; y' \<noteq> 0; z' \<noteq> 0; of_complex y' \<noteq> of_complex z'\<rbrakk> \<Longrightarrow> on_circline (poincare_line (of_complex y') (of_complex z')) 0\<^sub>h
[PROOF STEP]
apply (transfer, transfer, simp add: vec_cnj_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poincare_collinear {0\<^sub>h, of_complex y', of_complex z'} = (y' * cnj z' = cnj y' * z')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rat_to_int_poly_of_int: assumes rp: "rat_to_int_poly (map_poly of_int p) = (c,q)"
  shows "c = 1" "q = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c = 1 &&& q = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
define xs where "xs = map (snd \<circ> quotient_of) (coeffs (map_poly rat_of_int p))"
[PROOF STATE]
proof (state)
this:
xs = map (snd \<circ> quotient_of) (coeffs (of_int_poly p))

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
have xs: "set xs \<subseteq> {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs \<subseteq> {1}
[PROOF STEP]
unfolding xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (snd \<circ> quotient_of) (coeffs (of_int_poly p))) \<subseteq> {1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> {1}

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
from assms[unfolded rat_to_int_poly_def Let_def]
[PROOF STATE]
proof (chain)
picking this:
(fst (common_denom (coeffs (of_int_poly p))), map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * fst (common_denom (coeffs (of_int_poly p))) div x) (of_int_poly p)) = (c, q)
[PROOF STEP]
have c: "c = fst (common_denom (coeffs (map_poly rat_of_int p)))"
[PROOF STATE]
proof (prove)
using this:
(fst (common_denom (coeffs (of_int_poly p))), map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * fst (common_denom (coeffs (of_int_poly p))) div x) (of_int_poly p)) = (c, q)

goal (1 subgoal):
 1. c = fst (common_denom (coeffs (of_int_poly p)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c = fst (common_denom (coeffs (of_int_poly p)))

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c = fst (common_denom (coeffs (of_int_poly p)))

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
have "\<dots> = list_lcm xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (common_denom (coeffs (of_int_poly p))) = lcm_list xs
[PROOF STEP]
unfolding common_denom_def Let_def xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (lcm_list (map snd (map quotient_of (coeffs (of_int_poly p)))), map (\<lambda>(n, y). n * lcm_list (map snd (map quotient_of (coeffs (of_int_poly p)))) div y) (map quotient_of (coeffs (of_int_poly p)))) = lcm_list (map (snd \<circ> quotient_of) (coeffs (of_int_poly p)))
[PROOF STEP]
by (simp add: o_assoc)
[PROOF STATE]
proof (state)
this:
fst (common_denom (coeffs (of_int_poly p))) = lcm_list xs

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst (common_denom (coeffs (of_int_poly p))) = lcm_list xs

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm_list xs = 1
[PROOF STEP]
using xs
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> {1}

goal (1 subgoal):
 1. lcm_list xs = 1
[PROOF STEP]
by (induct xs, auto)
[PROOF STATE]
proof (state)
this:
lcm_list xs = 1

goal (2 subgoals):
 1. c = 1
 2. q = p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
c = 1
[PROOF STEP]
show c: "c = 1"
[PROOF STATE]
proof (prove)
using this:
c = 1

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

goal (1 subgoal):
 1. q = p
[PROOF STEP]
from rat_to_int_poly[OF rp, unfolded c]
[PROOF STATE]
proof (chain)
picking this:
of_int_poly p = smult (inverse (rat_of_int 1)) (of_int_poly q)
0 < 1
[PROOF STEP]
show "q = p"
[PROOF STATE]
proof (prove)
using this:
of_int_poly p = smult (inverse (rat_of_int 1)) (of_int_poly q)
0 < 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_at_Sup_mono:
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
    'b::{linorder_topology,conditionally_complete_linorder}"
  assumes "mono f"
    and cont: "continuous (at_left (Sup S)) f"
    and S: "S \<noteq> {}" "bdd_above S"
  shows "f (Sup S) = (SUP s\<in>S. f s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Sup S) = Sup (f ` S)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f (Sup S) \<le> Sup (f ` S)
 2. Sup (f ` S) \<le> f (Sup S)
[PROOF STEP]
have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
continuous (at_left (Sup S)) f

goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))

goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))

goal (2 subgoals):
 1. f (Sup S) \<le> Sup (f ` S)
 2. Sup (f ` S) \<le> f (Sup S)
[PROOF STEP]
show "f (Sup S) \<le> (SUP s\<in>S. f s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
 2. \<not> ?P \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
assume "Sup S \<in> S"
[PROOF STATE]
proof (state)
this:
Sup S \<in> S

goal (2 subgoals):
 1. ?P \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
 2. \<not> ?P \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup S \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup S \<in> S

goal (1 subgoal):
 1. f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
by (rule cSUP_upper) (auto intro: bdd_above_image_mono S \<open>mono f\<close>)
[PROOF STATE]
proof (state)
this:
f (Sup S) \<le> Sup (f ` S)

goal (1 subgoal):
 1. Sup S \<notin> S \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup S \<notin> S \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
assume "Sup S \<notin> S"
[PROOF STATE]
proof (state)
this:
Sup S \<notin> S

goal (1 subgoal):
 1. Sup S \<notin> S \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
from \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain s where "s \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>s. s \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<in> S

goal (1 subgoal):
 1. Sup S \<notin> S \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
with \<open>Sup S \<notin> S\<close> S
[PROOF STATE]
proof (chain)
picking this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
s \<in> S
[PROOF STEP]
have "s < Sup S"
[PROOF STATE]
proof (prove)
using this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
s \<in> S

goal (1 subgoal):
 1. s < Sup S
[PROOF STEP]
unfolding less_le
[PROOF STATE]
proof (prove)
using this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
s \<in> S

goal (1 subgoal):
 1. s \<le> Sup S \<and> s \<noteq> Sup S
[PROOF STEP]
by (blast intro: cSup_upper)
[PROOF STATE]
proof (state)
this:
s < Sup S

goal (1 subgoal):
 1. Sup S \<notin> S \<Longrightarrow> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> f (Sup S) \<le> Sup (f ` S) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> f (Sup S) \<le> Sup (f ` S)

goal (1 subgoal):
 1. \<not> f (Sup S) \<le> Sup (f ` S) \<Longrightarrow> False
[PROOF STEP]
with order_tendstoD(1)[OF f, of "SUP s\<in>S. f s"]
[PROOF STATE]
proof (chain)
picking this:
Sup (f ` S) < f (Sup S) \<Longrightarrow> \<forall>\<^sub>F x in at_left (Sup S). Sup (f ` S) < f x
\<not> f (Sup S) \<le> Sup (f ` S)
[PROOF STEP]
obtain b where "b < Sup S"
        and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> (SUP s\<in>S. f s) < f y"
[PROOF STATE]
proof (prove)
using this:
Sup (f ` S) < f (Sup S) \<Longrightarrow> \<forall>\<^sub>F x in at_left (Sup S). Sup (f ` S) < f x
\<not> f (Sup S) \<le> Sup (f ` S)

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>b < Sup S; \<And>y. \<lbrakk>b < y; y < Sup S\<rbrakk> \<Longrightarrow> Sup (f ` S) < f y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>])
[PROOF STATE]
proof (state)
this:
b < Sup S
\<lbrakk>b < ?y; ?y < Sup S\<rbrakk> \<Longrightarrow> Sup (f ` S) < f ?y

goal (1 subgoal):
 1. \<not> f (Sup S) \<le> Sup (f ` S) \<Longrightarrow> False
[PROOF STEP]
with \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
b < Sup S
\<lbrakk>b < ?y; ?y < Sup S\<rbrakk> \<Longrightarrow> Sup (f ` S) < f ?y
[PROOF STEP]
obtain c where "c \<in> S" "b < c"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
b < Sup S
\<lbrakk>b < ?y; ?y < Sup S\<rbrakk> \<Longrightarrow> Sup (f ` S) < f ?y

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> S; b < c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using less_cSupD[of S b]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
b < Sup S
\<lbrakk>b < ?y; ?y < Sup S\<rbrakk> \<Longrightarrow> Sup (f ` S) < f ?y
\<lbrakk>S \<noteq> {}; b < Sup S\<rbrakk> \<Longrightarrow> \<exists>x\<in>S. b < x

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> S; b < c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> S
b < c

goal (1 subgoal):
 1. \<not> f (Sup S) \<le> Sup (f ` S) \<Longrightarrow> False
[PROOF STEP]
with \<open>Sup S \<notin> S\<close> S
[PROOF STATE]
proof (chain)
picking this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
c \<in> S
b < c
[PROOF STEP]
have "c < Sup S"
[PROOF STATE]
proof (prove)
using this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
c \<in> S
b < c

goal (1 subgoal):
 1. c < Sup S
[PROOF STEP]
unfolding less_le
[PROOF STATE]
proof (prove)
using this:
Sup S \<notin> S
S \<noteq> {}
bdd_above S
c \<in> S
b \<le> c \<and> b \<noteq> c

goal (1 subgoal):
 1. c \<le> Sup S \<and> c \<noteq> Sup S
[PROOF STEP]
by (blast intro: cSup_upper)
[PROOF STATE]
proof (state)
this:
c < Sup S

goal (1 subgoal):
 1. \<not> f (Sup S) \<le> Sup (f ` S) \<Longrightarrow> False
[PROOF STEP]
from *[OF \<open>b < c\<close> \<open>c < Sup S\<close>] cSUP_upper[OF \<open>c \<in> S\<close> bdd_above_image_mono[of f]]
[PROOF STATE]
proof (chain)
picking this:
Sup (f ` S) < f c
\<lbrakk>mono f; bdd_above S\<rbrakk> \<Longrightarrow> f c \<le> Sup (f ` S)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
Sup (f ` S) < f c
\<lbrakk>mono f; bdd_above S\<rbrakk> \<Longrightarrow> f c \<le> Sup (f ` S)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (Sup S) \<le> Sup (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (Sup S) \<le> Sup (f ` S)

goal (1 subgoal):
 1. Sup (f ` S) \<le> f (Sup S)
[PROOF STEP]
qed (intro cSUP_least \<open>mono f\<close>[THEN monoD] cSup_upper S)


[STATEMENT]
lemma square_free_factorization_root:
  assumes sff: "square_free_factorization p (c,bs)"
    and p: "p \<noteq> (0 :: 'a poly)"
  shows "{x. poly p x = 0} = {x. \<exists> a i. (a,i) \<in> set bs \<and> poly a x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = (0::'a)} = {x. \<exists>a i. (a, i) \<in> set bs \<and> poly a x = (0::'a)}
[PROOF STEP]
using square_free_factorization_order_root[OF sff p] p
[PROOF STATE]
proof (prove)
using this:
(order ?x p = ?i) = (?i = 0 \<and> (\<forall>a j. (a, j) \<in> set bs \<longrightarrow> poly a ?x \<noteq> (0::'a)) \<or> (\<exists>a j. (a, j) \<in> set bs \<and> poly a ?x = (0::'a) \<and> ?i = Suc j))
p \<noteq> 0

goal (1 subgoal):
 1. {x. poly p x = (0::'a)} = {x. \<exists>a i. (a, i) \<in> set bs \<and> poly a x = (0::'a)}
[PROOF STEP]
unfolding order_root
[PROOF STATE]
proof (prove)
using this:
(order ?x p = ?i) = (?i = 0 \<and> (\<forall>a j. (a, j) \<in> set bs \<longrightarrow> \<not> (a = 0 \<or> order ?x a \<noteq> 0)) \<or> (\<exists>a j. (a, j) \<in> set bs \<and> (a = 0 \<or> order ?x a \<noteq> 0) \<and> ?i = Suc j))
p \<noteq> 0

goal (1 subgoal):
 1. {x. p = 0 \<or> order x p \<noteq> 0} = {x. \<exists>a i. (a, i) \<in> set bs \<and> (a = 0 \<or> order x a \<noteq> 0)}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in wf_digraph) closed_euler_imp_eq_degree:
  assumes "euler_trail u p u"
  assumes "v \<in> verts G"
  shows "in_degree G v = out_degree G v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p u
v \<in> verts G
[PROOF STEP]
have "arc_balanced u p u" "set p = arcs G"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p u
v \<in> verts G

goal (1 subgoal):
 1. arc_balanced u p u &&& set p = arcs G
[PROOF STEP]
unfolding euler_trail_def
[PROOF STATE]
proof (prove)
using this:
trail u p u \<and> set p = arcs G \<and> set (awalk_verts u p) = verts G
v \<in> verts G

goal (1 subgoal):
 1. arc_balanced u p u &&& set p = arcs G
[PROOF STEP]
by (auto dest: arc_balancedI_trail)
[PROOF STATE]
proof (state)
this:
arc_balanced u p u
set p = arcs G

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p u
v \<in> verts G
arc_balanced u p u
set p = arcs G
[PROOF STEP]
have "arc_balance v p = 0"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p u
v \<in> verts G
arc_balanced u p u
set p = arcs G

goal (1 subgoal):
 1. arc_balance v p = 0
[PROOF STEP]
unfolding arc_set_balanced_def
[PROOF STATE]
proof (prove)
using this:
euler_trail u p u
v \<in> verts G
if u = u then \<forall>w\<in>verts G. arc_balance w p = 0 else (\<forall>w\<in>verts G. w \<noteq> u \<and> w \<noteq> u \<longrightarrow> arc_balance w p = 0) \<and> arc_balance u p = - 1 \<and> arc_balance u p = 1
set p = arcs G

goal (1 subgoal):
 1. arc_balance v p = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arc_balance v p = 0

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
arc_balance v p = 0

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
from \<open>set p = _\<close>
[PROOF STATE]
proof (chain)
picking this:
set p = arcs G
[PROOF STEP]
have "in_arcs G v \<inter> set p = in_arcs G v" "out_arcs G v \<inter> set p = out_arcs G v"
[PROOF STATE]
proof (prove)
using this:
set p = arcs G

goal (1 subgoal):
 1. in_arcs G v \<inter> set p = in_arcs G v &&& out_arcs G v \<inter> set p = out_arcs G v
[PROOF STEP]
by (auto intro: in_arcs_in_arcs out_arcs_in_arcs)
[PROOF STATE]
proof (state)
this:
in_arcs G v \<inter> set p = in_arcs G v
out_arcs G v \<inter> set p = out_arcs G v

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
arc_balance v p = 0
in_arcs G v \<inter> set p = in_arcs G v
out_arcs G v \<inter> set p = out_arcs G v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arc_balance v p = 0
in_arcs G v \<inter> set p = in_arcs G v
out_arcs G v \<inter> set p = out_arcs G v

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
unfolding arc_set_balance_def in_degree_def out_degree_def
[PROOF STATE]
proof (prove)
using this:
int (card (in_arcs G v \<inter> set p)) - int (card (out_arcs G v \<inter> set p)) = 0
in_arcs G v \<inter> set p = in_arcs G v
out_arcs G v \<inter> set p = out_arcs G v

goal (1 subgoal):
 1. card (in_arcs G v) = card (out_arcs G v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
in_degree G v = out_degree G v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_Arg_i_mult_zero [simp]: "y \<noteq> 0 \<Longrightarrow> Re y = 0 \<Longrightarrow> cos (Arg y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<noteq> 0; Re y = 0\<rbrakk> \<Longrightarrow> cos (Arg y) = 0
[PROOF STEP]
using cis_Arg [of y]
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0 \<Longrightarrow> cis (Arg y) = sgn y

goal (1 subgoal):
 1. \<lbrakk>y \<noteq> 0; Re y = 0\<rbrakk> \<Longrightarrow> cos (Arg y) = 0
[PROOF STEP]
by (simp add: complex_eq_iff)