[STATEMENT]
lemma nth_root_nat_aux2:
  assumes "k > 0"
  shows   "finite {m::nat. m ^ k \<le> n}" "{m::nat. m ^ k \<le> n} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {m. m ^ k \<le> n} &&& {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {m. m ^ k \<le> n}
 2. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
have "{m. m ^ k \<le> n} \<subseteq> {..n}"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. {m. m ^ k \<le> n} \<subseteq> {..n}
[PROOF STEP]
by (rule nth_root_nat_aux1)
[PROOF STATE]
proof (state)
this:
{m. m ^ k \<le> n} \<subseteq> {..n}

goal (2 subgoals):
 1. finite {m. m ^ k \<le> n}
 2. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{m. m ^ k \<le> n} \<subseteq> {..n}

goal (2 subgoals):
 1. finite {m. m ^ k \<le> n}
 2. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
have "finite {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {..n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {..n}

goal (2 subgoals):
 1. finite {m. m ^ k \<le> n}
 2. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{m. m ^ k \<le> n} \<subseteq> {..n}
finite {..n}
[PROOF STEP]
show "finite {m::nat. m ^ k \<le> n}"
[PROOF STATE]
proof (prove)
using this:
{m. m ^ k \<le> n} \<subseteq> {..n}
finite {..n}

goal (1 subgoal):
 1. finite {m. m ^ k \<le> n}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {m. m ^ k \<le> n}

goal (1 subgoal):
 1. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
show "{m::nat. m ^ k \<le> n} \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. {m. m ^ k \<le> n} \<noteq> {}
[PROOF STEP]
by (auto intro!: exI[of _ 0] simp: power_0_left)
[PROOF STATE]
proof (state)
this:
{m. m ^ k \<le> n} \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_Pair [tendsto_intros]:
  assumes "(f \<longlongrightarrow> a) F" and "(g \<longlongrightarrow> b) F"
  shows "((\<lambda>x. (f x, g x)) \<longlongrightarrow> (a, b)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f x, g x)) \<longlongrightarrow> (a, b)) F
[PROOF STEP]
unfolding nhds_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. (f x, g x) :> nhds a \<times>\<^sub>F nhds b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> a) F
(g \<longlongrightarrow> b) F

goal (1 subgoal):
 1. LIM x F. (f x, g x) :> nhds a \<times>\<^sub>F nhds b
[PROOF STEP]
by (rule filterlim_Pair)


[STATEMENT]
lemma Carmichael_2 [simp]: "Carmichael 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael 2 = 1
[PROOF STEP]
using Carmichael_dvd_totient[of 2]
[PROOF STATE]
proof (prove)
using this:
Carmichael 2 dvd totient 2

goal (1 subgoal):
 1. Carmichael 2 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma powr_mono': "a \<le> (b::real) \<Longrightarrow> x \<ge> 0 \<Longrightarrow> x \<le> 1 \<Longrightarrow> x powr b \<le> x powr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> x powr b \<le> x powr a
[PROOF STEP]
using powr_mono[of "-b" "-a" "inverse x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- b \<le> - a; 1 \<le> inverse x\<rbrakk> \<Longrightarrow> inverse x powr - b \<le> inverse x powr - a

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> x powr b \<le> x powr a
[PROOF STEP]
by (auto simp: powr_def ln_inverse ln_div field_split_simps)


[STATEMENT]
lemma det_sylvester_matrix_higher_degree:
  "det (sylvester_mat_sub (degree f + n) (degree g) f g)
  = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (-1)^(degree g))^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
let ?A = "sylvester_mat_sub (degree f + Suc n) (degree g) f g"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
let ?d = "degree f + Suc n + degree g"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
define h where "h i = ?A $$ (i,0) * cofactor ?A i 0" for i
[PROOF STATE]
proof (state)
this:
h ?i = sylvester_mat_sub (degree f + Suc n) (degree g) f g $$ (?i, 0) * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) ?i 0

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have mult_left_zero: "x = 0 \<Longrightarrow> x * y = 0" for x y :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> x * y = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x = (0::'a) \<Longrightarrow> ?x * ?y = (0::'a)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "det ?A = (\<Sum>i<?d. h i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = sum h {..<degree f + Suc n + degree g}
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = (\<Sum>i<degree f + Suc n + degree g. sylvester_mat_sub (degree f + Suc n) (degree g) f g $$ (i, 0) * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) i 0)
[PROOF STEP]
by (rule laplace_expansion_column[OF sylvester_mat_sub_carrier, of 0], force)
[PROOF STATE]
proof (state)
this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = sum h {..<degree f + Suc n + degree g}

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = sum h {..<degree f + Suc n + degree g}

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "\<dots> = sum h ({degree g} \<union> ({..<?d} - {degree g}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h {..<degree f + Suc n + degree g} = sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g}))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
sum h {..<degree f + Suc n + degree g} = sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g}))

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h {..<degree f + Suc n + degree g} = sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g}))

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "\<dots> = sum h {degree g} + sum h ({..<?d} - {degree g})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g})) = sum h {degree g} + sum h ({..<degree f + Suc n + degree g} - {degree g})
[PROOF STEP]
by (rule sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g})) = sum h {degree g} + sum h ({..<degree f + Suc n + degree g} - {degree g})

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h ({degree g} \<union> ({..<degree f + Suc n + degree g} - {degree g})) = sum h {degree g} + sum h ({..<degree f + Suc n + degree g} - {degree g})

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "sum h ({..<?d} - {degree g}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h ({..<degree f + Suc n + degree g} - {degree g}) = (0::'a)
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{..<degree f + Suc n + degree g} - {degree g}. sylvester_mat_sub (degree f + Suc n) (degree g) f g $$ (i, 0) * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) i 0) = (0::'a)
[PROOF STEP]
by (intro sum.neutral ballI mult_left_zero, auto simp: sylvester_mat_sub_def coeff_eq_0)
[PROOF STATE]
proof (state)
this:
sum h ({..<degree f + Suc n + degree g} - {degree g}) = (0::'a)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h ({..<degree f + Suc n + degree g} - {degree g}) = (0::'a)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "sum h {degree g} = h (degree g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h {degree g} = h (degree g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum h {degree g} = h (degree g)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h {degree g} = h (degree g)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "\<dots> = lead_coeff g * cofactor ?A (degree g) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (degree g) = lead_coeff g * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sylvester_mat_sub (degree f + Suc n) (degree g) f g $$ (degree g, 0) * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = lead_coeff g * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0
[PROOF STEP]
by (rule arg_cong[of _ _ "\<lambda> x. x * _"], simp add: sylvester_mat_sub_def)
[PROOF STATE]
proof (state)
this:
h (degree g) = lead_coeff g * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h (degree g) = lead_coeff g * cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
have "cofactor ?A (degree g) 0 = (-1)^(degree g) * det (sylvester_mat_sub (degree f + n) (degree g) f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = (- (1::'a)) ^ degree g * det (sylvester_mat_sub (degree f + n) (degree g) f g)
[PROOF STEP]
unfolding cofactor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ (degree g + 0) * det (mat_delete (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0) = (- (1::'a)) ^ degree g * det (sylvester_mat_sub (degree f + n) (degree g) f g)
[PROOF STEP]
proof (intro arg_cong2[of _ _ _ _ "\<lambda> x y. (-1)^x * det y"], force)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_delete (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = sylvester_mat_sub (degree f + n) (degree g) f g
[PROOF STEP]
show "mat_delete ?A (degree g) 0 = sylvester_mat_sub (degree f + n) (degree g) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_delete (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = sylvester_mat_sub (degree f + n) (degree g) f g
[PROOF STEP]
unfolding sylvester_mat_sub_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_delete (mat (degree f + Suc n + degree g) (degree f + Suc n + degree g) (\<lambda>(i, j). if i < degree g then if i \<le> j \<and> j - i \<le> degree f + Suc n then coeff f (degree f + Suc n + i - j) else (0::'a) else if i - degree g \<le> j \<and> j \<le> i then coeff g (i - j) else (0::'a))) (degree g) 0 = mat (degree f + n + degree g) (degree f + n + degree g) (\<lambda>(i, j). if i < degree g then if i \<le> j \<and> j - i \<le> degree f + n then coeff f (degree f + n + i - j) else (0::'a) else if i - degree g \<le> j \<and> j \<le> i then coeff g (i - j) else (0::'a))
[PROOF STEP]
by (intro eq_matI, auto simp: mat_delete_def coeff_eq_0)
[PROOF STATE]
proof (state)
this:
mat_delete (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = sylvester_mat_sub (degree f + n) (degree g) f g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cofactor (sylvester_mat_sub (degree f + Suc n) (degree g) f g) (degree g) 0 = (- (1::'a)) ^ degree g * det (sylvester_mat_sub (degree f + n) (degree g) f g)

goal (2 subgoals):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
 2. \<And>n. det (sylvester_mat_sub (degree f + n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n \<Longrightarrow> det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = lead_coeff g * ((- (1::'a)) ^ degree g * det (sylvester_mat_sub (degree f + n) (degree g) f g)) + (0::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = lead_coeff g * ((- (1::'a)) ^ degree g * det (sylvester_mat_sub (degree f + n) (degree g) f g)) + (0::'a)

goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
using this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = lead_coeff g * ((- (1::'a)) ^ degree g * (det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ n)) + (0::'a)

goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (sylvester_mat_sub (degree f + Suc n) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ Suc n

goal (1 subgoal):
 1. det (sylvester_mat_sub (degree f + 0) (degree g) f g) = det (sylvester_mat_sub (degree f) (degree g) f g) * (lead_coeff g * (- (1::'a)) ^ degree g) ^ 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma admits_diagonal_reduction_intro:
  assumes "P \<in> carrier_mat (dim_row A) (dim_row A)"
    and "Q \<in> carrier_mat (dim_col A) (dim_col A)"
    and "invertible_mat P" and "invertible_mat Q "
    and "Smith_normal_form_mat (P * A * Q)"
  shows "admits_diagonal_reduction A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. admits_diagonal_reduction A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat (dim_row A) (dim_row A)
Q \<in> carrier_mat (dim_col A) (dim_col A)
invertible_mat P
invertible_mat Q
Smith_normal_form_mat (P * A * Q)

goal (1 subgoal):
 1. admits_diagonal_reduction A
[PROOF STEP]
unfolding admits_diagonal_reduction_def
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat (dim_row A) (dim_row A)
Q \<in> carrier_mat (dim_col A) (dim_col A)
invertible_mat P
invertible_mat Q
Smith_normal_form_mat (P * A * Q)

goal (1 subgoal):
 1. \<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q)
[PROOF STEP]
by fast


[STATEMENT]
lemma semilat_Def:
"semilat(A,r,f) \<longleftrightarrow> order r A \<and> closed A f \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^sub>r x \<squnion>\<^sub>f y) \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^sub>r x \<squnion>\<^sub>f y) \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^sub>r z \<and> y \<sqsubseteq>\<^sub>r z \<longrightarrow> x \<squnion>\<^sub>f y \<sqsubseteq>\<^sub>r z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semilat (A, r, f) = (order r A \<and> closed A f \<and> (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> z \<and> y \<sqsubseteq>\<^bsub>r\<^esub> z \<longrightarrow> x \<squnion>\<^bsub>f\<^esub> y \<sqsubseteq>\<^bsub>r\<^esub> z))
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semilat (A, r, f) = (order r A \<and> closed A f \<and> (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> z \<and> y \<sqsubseteq>\<^bsub>r\<^esub> z \<longrightarrow> x \<squnion>\<^bsub>f\<^esub> y \<sqsubseteq>\<^bsub>r\<^esub> z))
[PROOF STEP]
by (unfold semilat_def) clarsimp


[STATEMENT]
lemma LIMSEQ_indicator_incseq:
  assumes "incseq A"
  shows "(\<lambda>i. indicator (A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Union>i. A i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
proof (cases "\<exists>i. x \<in> A i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
 2. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>i. x \<in> A i

goal (2 subgoals):
 1. \<exists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
 2. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. x \<in> A i
[PROOF STEP]
obtain i where "x \<in> A i"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. x \<in> A i

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

goal (2 subgoals):
 1. \<exists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
 2. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A i
[PROOF STEP]
have *:
    "\<And>n. (indicator (A (n + i)) x :: 'a) = 1"
    "(indicator (\<Union>i. A i) x :: 'a) = 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> A i

goal (1 subgoal):
 1. (\<And>n. indicator (A (n + i)) x = (1::'a)) &&& indicator (\<Union> (range A)) x = (1::'a)
[PROOF STEP]
using incseqD[OF \<open>incseq A\<close>, of i "n + i" for n] \<open>x \<in> A i\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> A i
i \<le> ?n2 + i \<Longrightarrow> A i \<subseteq> A (?n2 + i)
x \<in> A i

goal (1 subgoal):
 1. (\<And>n. indicator (A (n + i)) x = (1::'a)) &&& indicator (\<Union> (range A)) x = (1::'a)
[PROOF STEP]
by (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
indicator (A (?n + i)) x = (1::'a)
indicator (\<Union> (range A)) x = (1::'a)

goal (2 subgoals):
 1. \<exists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
 2. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
by (rule LIMSEQ_offset[of _ i]) (use * in simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x

goal (1 subgoal):
 1. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>i. x \<in> A i

goal (1 subgoal):
 1. \<nexists>i. x \<in> A i \<Longrightarrow> (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<nexists>i. x \<in> A i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nexists>i. x \<in> A i

goal (1 subgoal):
 1. (\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x
[PROOF STEP]
by (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. indicator (A i) x) \<longlonglongrightarrow> indicator (\<Union> (range A)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma k: "F (Suc k) = 0" "i < k \<Longrightarrow> F (Suc i) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (Suc k) = 0 &&& (i < k \<Longrightarrow> F (Suc i) \<noteq> 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F (Suc k) = 0
 2. i < k \<Longrightarrow> F (Suc i) \<noteq> 0
[PROOF STEP]
show "F (Suc k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (Suc k) = 0
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (Suc (LEAST i. F (Suc i) = 0)) = 0
[PROOF STEP]
using k_exists
[PROOF STATE]
proof (prove)
using this:
\<exists>i. F (Suc i) = 0

goal (1 subgoal):
 1. F (Suc (LEAST i. F (Suc i) = 0)) = 0
[PROOF STEP]
by (rule LeastI2_ex)
[PROOF STATE]
proof (state)
this:
F (Suc k) = 0

goal (1 subgoal):
 1. i < k \<Longrightarrow> F (Suc i) \<noteq> 0
[PROOF STEP]
assume "i < k"
[PROOF STATE]
proof (state)
this:
i < k

goal (1 subgoal):
 1. i < k \<Longrightarrow> F (Suc i) \<noteq> 0
[PROOF STEP]
from not_less_Least[OF this[unfolded k_def]]
[PROOF STATE]
proof (chain)
picking this:
F (Suc i) \<noteq> 0
[PROOF STEP]
show "F (Suc i) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
F (Suc i) \<noteq> 0

goal (1 subgoal):
 1. F (Suc i) \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
F (Suc i) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_diff_numeral [simp]: "\<lfloor>x - numeral v\<rfloor> = \<lfloor>x\<rfloor> - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x - numeral v\<rfloor> = \<lfloor>x\<rfloor> - numeral v
[PROOF STEP]
using floor_diff_of_int [of x "numeral v"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>x - of_int (numeral v)\<rfloor> = \<lfloor>x\<rfloor> - numeral v

goal (1 subgoal):
 1. \<lfloor>x - numeral v\<rfloor> = \<lfloor>x\<rfloor> - numeral v
[PROOF STEP]
by simp


[STATEMENT]
lemma (in finite_incidence_system) exists_ordering_sysI: "\<exists> Vs Bs . Vs \<in> permutations_of_set \<V> \<and>
  Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
obtain Vs where "Vs \<in> permutations_of_set \<V>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Vs. Vs \<in> permutations_of_set \<V> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson all_not_in_conv finite_sets permutations_of_set_empty_iff)
[PROOF STATE]
proof (state)
this:
Vs \<in> permutations_of_set \<V>

goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
obtain Bs where "Bs \<in> permutations_of_multiset \<B>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Bs. Bs \<in> permutations_of_multiset \<B> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson all_not_in_conv permutations_of_multiset_not_empty)
[PROOF STATE]
proof (state)
this:
Bs \<in> permutations_of_multiset \<B>

goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Bs \<in> permutations_of_multiset \<B>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Bs \<in> permutations_of_multiset \<B>

goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
using alt_ordering_sysI \<open>Vs \<in> permutations_of_set \<V>\<close>
[PROOF STATE]
proof (prove)
using this:
Bs \<in> permutations_of_multiset \<B>
\<lbrakk>?Vs \<in> permutations_of_set \<V>; ?Bs \<in> permutations_of_multiset \<B>\<rbrakk> \<Longrightarrow> ordered_incidence_system ?Vs ?Bs
Vs \<in> permutations_of_set \<V>

goal (1 subgoal):
 1. \<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>Vs Bs. Vs \<in> permutations_of_set \<V> \<and> Bs \<in> permutations_of_multiset \<B> \<and> ordered_incidence_system Vs Bs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma leq_n:
  assumes "\<forall>i. 0 < p i \<longrightarrow> 1 \<le> i \<and> i \<le> (n::nat)"
  assumes "(\<Sum>i\<le>n. p i * i) = n"
  shows "p i * i \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p i * i \<le> n
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> p i * i \<le> n \<Longrightarrow> False
[PROOF STEP]
assume "\<not> p i * i \<le> n"
[PROOF STATE]
proof (state)
this:
\<not> p i * i \<le> n

goal (1 subgoal):
 1. \<not> p i * i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<not> p i * i \<le> n
[PROOF STEP]
have gr_n: "p i * i > n"
[PROOF STATE]
proof (prove)
using this:
\<not> p i * i \<le> n

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

goal (1 subgoal):
 1. \<not> p i * i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this assms(1)
[PROOF STATE]
proof (chain)
picking this:
n < p i * i
\<forall>i. 0 < p i \<longrightarrow> 1 \<le> i \<and> i \<le> n
[PROOF STEP]
have "1 \<le> i \<and> i \<le> n"
[PROOF STATE]
proof (prove)
using this:
n < p i * i
\<forall>i. 0 < p i \<longrightarrow> 1 \<le> i \<and> i \<le> n

goal (1 subgoal):
 1. 1 \<le> i \<and> i \<le> n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
1 \<le> i \<and> i \<le> n

goal (1 subgoal):
 1. \<not> p i * i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
1 \<le> i \<and> i \<le> n
[PROOF STEP]
have "(\<Sum>j\<le>n. p j * j) = p i * i + (\<Sum>j | j \<le> n \<and> j \<noteq> i. p j * j)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<and> i \<le> n

goal (1 subgoal):
 1. (\<Sum>j\<le>n. p j * j) = p i * i + (\<Sum>j | j \<le> n \<and> j \<noteq> i. p j * j)
[PROOF STEP]
by (subst sum.insert[symmetric]) (auto intro: sum.cong simp del: sum.insert)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>n. p j * j) = p i * i + (\<Sum>j | j \<le> n \<and> j \<noteq> i. p j * j)

goal (1 subgoal):
 1. \<not> p i * i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this gr_n assms(2)
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<le>n. p j * j) = p i * i + (\<Sum>j | j \<le> n \<and> j \<noteq> i. p j * j)
n < p i * i
(\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<le>n. p j * j) = p i * i + (\<Sum>j | j \<le> n \<and> j \<noteq> i. p j * j)
n < p i * i
(\<Sum>i\<le>n. p i * i) = n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_eqI:
  "\<lbrakk> dom f = dom g; \<forall> x\<in>dom(f). the(f x) = the(g x) \<rbrakk> \<Longrightarrow> f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dom f = dom g; \<forall>x\<in>dom f. the (f x) = the (g x)\<rbrakk> \<Longrightarrow> f = g
[PROOF STEP]
by (metis domIff map_le_antisym map_le_def option.expand)


[STATEMENT]
lemma sublist_antisym:
  assumes "subseq l1 l2" "subseq l2 l1"
  shows "(l1 = l2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l1 = l2
[PROOF STEP]
using assms subseq_order.antisym
[PROOF STATE]
proof (prove)
using this:
subseq l1 l2
subseq l2 l1
\<lbrakk>subseq ?a ?b; subseq ?b ?a\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. l1 = l2
[PROOF STEP]
by blast


[STATEMENT]
lemma card_children:
  assumes "\<not>(is_leaf l)"
  shows "card (children l) = N - (length_lbl l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<not> is_leaf l
[PROOF STEP]
have "last_lbl ` (children l) = UNIV - set_lbl l"
[PROOF STATE]
proof (prove)
using this:
\<not> is_leaf l

goal (1 subgoal):
 1. last_lbl ` children l = UNIV - set_lbl l
[PROOF STEP]
by (rule children_last_set)
[PROOF STATE]
proof (state)
this:
last_lbl ` children l = UNIV - set_lbl l

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
last_lbl ` children l = UNIV - set_lbl l

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
have "card (UNIV - set_lbl l) = card (UNIV::Proc set) - card (set_lbl l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (UNIV - set_lbl l) = N - card (set_lbl l)
[PROOF STEP]
by (auto simp: card_Diff_subset_Int)
[PROOF STATE]
proof (state)
this:
card (UNIV - set_lbl l) = N - card (set_lbl l)

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (UNIV - set_lbl l) = N - card (set_lbl l)

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
from last_lbl_inj_on_children
[PROOF STATE]
proof (chain)
picking this:
inj_on last_lbl (children ?l)
[PROOF STEP]
have "card (children l) = card (last_lbl ` children l)"
[PROOF STATE]
proof (prove)
using this:
inj_on last_lbl (children ?l)

goal (1 subgoal):
 1. card (children l) = card (last_lbl ` children l)
[PROOF STEP]
by (rule sym[OF card_image])
[PROOF STATE]
proof (state)
this:
card (children l) = card (last_lbl ` children l)

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (children l) = card (last_lbl ` children l)

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
note card_set_lbl[of l]
[PROOF STATE]
proof (state)
this:
card (set_lbl l) = length_lbl l

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
last_lbl ` children l = UNIV - set_lbl l
card (UNIV - set_lbl l) = N - card (set_lbl l)
card (children l) = card (last_lbl ` children l)
card (set_lbl l) = length_lbl l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
last_lbl ` children l = UNIV - set_lbl l
card (UNIV - set_lbl l) = N - card (set_lbl l)
card (children l) = card (last_lbl ` children l)
card (set_lbl l) = length_lbl l

goal (1 subgoal):
 1. card (children l) = N - length_lbl l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (children l) = N - length_lbl l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_OPT:
  "finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}" (is "finite ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
have "?S \<subseteq> {xs. subseq xs (take i A)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. subseq xs (take i A) \<and> subseq xs (take j B)} \<subseteq> {xs. subseq xs (take i A)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. subseq xs (take i A) \<and> subseq xs (take j B)} \<subseteq> {xs. subseq xs (take i A)}

goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{xs. subseq xs (take i A) \<and> subseq xs (take j B)} \<subseteq> {xs. subseq xs (take i A)}

goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
have "finite \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. subseq xs (take i A)}
[PROOF STEP]
by (rule finite_subseq)
[PROOF STATE]
proof (state)
this:
finite {xs. subseq xs (take i A)}

goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{xs. subseq xs (take i A) \<and> subseq xs (take j B)} \<subseteq> {xs. subseq xs (take i A)}
finite {xs. subseq xs (take i A)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{xs. subseq xs (take i A) \<and> subseq xs (take j B)} \<subseteq> {xs. subseq xs (take i A)}
finite {xs. subseq xs (take i A)}

goal (1 subgoal):
 1. finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {xs. subseq xs (take i A) \<and> subseq xs (take j B)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_injective_isomorphism:
  assumes lf: "linear s1 s2 f"
    and fi: "inj f"
    and dims: "vs2.dim UNIV = vs1.dim UNIV"
  shows "\<exists>f'. linear s2 s1 f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)
[PROOF STEP]
unfolding isomorphism_expand[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> f' \<circ> f = id \<and> f \<circ> f' = id
[PROOF STEP]
using linear_injective_imp_surjective[OF lf fi dims]
[PROOF STATE]
proof (prove)
using this:
surj f

goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> f' \<circ> f = id \<and> f \<circ> f' = id
[PROOF STEP]
using fi left_right_inverse_eq lf linear_injective_left_inverse linear_surjective_right_inverse
[PROOF STATE]
proof (prove)
using this:
surj f
inj f
\<lbrakk>?f \<circ> ?g = id; ?g \<circ> ?h = id\<rbrakk> \<Longrightarrow> ?f = ?h
linear (*a) (*b) f
\<lbrakk>linear (*a) (*b) ?f; inj ?f\<rbrakk> \<Longrightarrow> \<exists>g. linear (*b) (*a) g \<and> g \<circ> ?f = id
\<lbrakk>linear (*a) (*b) ?f; surj ?f\<rbrakk> \<Longrightarrow> \<exists>g. linear (*b) (*a) g \<and> ?f \<circ> g = id

goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> f' \<circ> f = id \<and> f \<circ> f' = id
[PROOF STEP]
by blast


[STATEMENT]
theorem (in v0_v1_Digraph) menger:
  assumes "\<And>S. Separation G v0 v1 S \<Longrightarrow> card S \<ge> n"
  shows "\<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n
[PROOF STEP]
using assms v0_v1_Digraph_axioms
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> n \<le> card ?S
v0_v1_Digraph G v0 v1

goal (1 subgoal):
 1. \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n
[PROOF STEP]
proof (induct n arbitrary: G)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> 0 \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = 0
 2. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
case (0 G)
[PROOF STATE]
proof (state)
this:
Separation G v0 v1 ?S \<Longrightarrow> 0 \<le> card ?S
v0_v1_Digraph G v0 v1

goal (2 subgoals):
 1. \<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> 0 \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = 0
 2. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Separation G v0 v1 ?S \<Longrightarrow> 0 \<le> card ?S
v0_v1_Digraph G v0 v1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> 0 \<le> card ?S
v0_v1_Digraph G v0 v1

goal (1 subgoal):
 1. \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = 0
[PROOF STEP]
using v0_v1_Digraph.DisjointPaths_empty[of G] card.empty
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> 0 \<le> card ?S
v0_v1_Digraph G v0 v1
v0_v1_Digraph G ?v0.0 ?v1.0 \<Longrightarrow> DisjointPaths G ?v0.0 ?v1.0 {}
card {} = 0

goal (1 subgoal):
 1. \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = 0

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
case (Suc n G)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>S. Separation ?G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph ?G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths ?G v0 v1 paths \<and> card paths = n
Separation G v0 v1 ?S \<Longrightarrow> Suc n \<le> card ?S
v0_v1_Digraph G v0 v1

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
interpret G: v0_v1_Digraph G v0 v1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v0_v1_Digraph G v0 v1
[PROOF STEP]
using Suc(3)
[PROOF STATE]
proof (prove)
using this:
v0_v1_Digraph G v0 v1

goal (1 subgoal):
 1. v0_v1_Digraph G v0 v1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
have "\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S
[PROOF STEP]
using Suc.prems Suc_leD
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> Suc n \<le> card ?S
v0_v1_Digraph G v0 v1
Suc ?m \<le> ?n \<Longrightarrow> ?m \<le> ?n

goal (1 subgoal):
 1. \<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Separation G v0 v1 ?S \<Longrightarrow> n \<le> card ?S

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Separation G v0 v1 ?S \<Longrightarrow> n \<le> card ?S
[PROOF STEP]
obtain paths where P: "DisjointPaths G v0 v1 paths" "card paths = n"
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> n \<le> card ?S

goal (1 subgoal):
 1. (\<And>paths. \<lbrakk>DisjointPaths G v0 v1 paths; card paths = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc(1,3)
[PROOF STATE]
proof (prove)
using this:
Separation G v0 v1 ?S \<Longrightarrow> n \<le> card ?S
\<lbrakk>\<And>S. Separation ?G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph ?G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths ?G v0 v1 paths \<and> card paths = n
v0_v1_Digraph G v0 v1

goal (1 subgoal):
 1. (\<And>paths. \<lbrakk>DisjointPaths G v0 v1 paths; card paths = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
DisjointPaths G v0 v1 paths
card paths = n

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
interpret G: DisjointPaths G v0 v1 paths
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DisjointPaths G v0 v1 paths
[PROOF STEP]
using P(1)
[PROOF STATE]
proof (prove)
using this:
DisjointPaths G v0 v1 paths

goal (1 subgoal):
 1. DisjointPaths G v0 v1 paths
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
obtain P_new where
    P_new: "v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1" "set P_new \<inter> G.second_vertices = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P_new. \<lbrakk>v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1; set P_new \<inter> G.second_vertices = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using G.disjoint_paths_new_path P(2) Suc.prems(1)
[PROOF STATE]
proof (prove)
using this:
(\<And>S. Separation G v0 v1 S \<Longrightarrow> Suc (card paths) \<le> card S) \<Longrightarrow> \<exists>P_new. v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1 \<and> set P_new \<inter> G.second_vertices = {}
card paths = n
Separation G v0 v1 ?S \<Longrightarrow> Suc n \<le> card ?S

goal (1 subgoal):
 1. (\<And>P_new. \<lbrakk>v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1; set P_new \<inter> G.second_vertices = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1
set P_new \<inter> G.second_vertices = {}

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
have P_new_new: "P_new \<notin> paths"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_new \<notin> paths
[PROOF STEP]
by (metis G.paths_tl_notnil G.second_vertex_def G.second_vertices_def G.path_from_toE IntI
        P_new empty_iff image_eqI list.set_sel(1) list.set_sel(2))
[PROOF STATE]
proof (state)
this:
P_new \<notin> paths

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
have "G.hitting_paths v1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G.hitting_paths v1
[PROOF STEP]
unfolding G.hitting_paths_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v1 \<noteq> v0 \<and> ((\<exists>xs\<in>paths. v1 \<in> set xs) \<or> v1 = v1)
[PROOF STEP]
using v0_neq_v1
[PROOF STATE]
proof (prove)
using this:
v0 \<noteq> v1

goal (1 subgoal):
 1. v1 \<noteq> v0 \<and> ((\<exists>xs\<in>paths. v1 \<in> set xs) \<or> v1 = v1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
G.hitting_paths v1

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
G.hitting_paths v1
[PROOF STEP]
have "\<exists>x \<in> set P_new. G.hitting_paths x"
[PROOF STATE]
proof (prove)
using this:
G.hitting_paths v1

goal (1 subgoal):
 1. Bex (set P_new) G.hitting_paths
[PROOF STEP]
using P_new(1)
[PROOF STATE]
proof (prove)
using this:
G.hitting_paths v1
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1

goal (1 subgoal):
 1. Bex (set P_new) G.hitting_paths
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Bex (set P_new) G.hitting_paths

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Bex (set P_new) G.hitting_paths
[PROOF STEP]
obtain new_pre x new_post where
    P_new_decomp: "P_new = new_pre @ x # new_post"
    and x: "G.hitting_paths x"
           "\<And>y. y \<in> set new_pre \<Longrightarrow> \<not>G.hitting_paths y"
[PROOF STATE]
proof (prove)
using this:
Bex (set P_new) G.hitting_paths

goal (1 subgoal):
 1. (\<And>new_pre x new_post. \<lbrakk>P_new = new_pre @ x # new_post; G.hitting_paths x; \<And>y. y \<in> set new_pre \<Longrightarrow> \<not> G.hitting_paths y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis split_list_first_prop)
[PROOF STATE]
proof (state)
this:
P_new = new_pre @ x # new_post
G.hitting_paths x
?y \<in> set new_pre \<Longrightarrow> \<not> G.hitting_paths ?y

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
have 1: "DisjointPathsPlusOne G v0 v1 paths (new_pre @ [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DisjointPathsPlusOne G v0 v1 paths (new_pre @ [x])
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])
 2. tl (new_pre @ [x]) \<noteq> []
 3. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
 4. G.hitting_paths (last (new_pre @ [x]))
 5. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
show "v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])
[PROOF STEP]
using P_new(1)
[PROOF STATE]
proof (prove)
using this:
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1

goal (1 subgoal):
 1. v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])
[PROOF STEP]
by (metis G.path_decomp' P_new_decomp append_is_Nil_conv hd_append2 list.distinct(1)
          list.sel(1) path_from_to_def self_append_conv2)
[PROOF STATE]
proof (state)
this:
v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])

goal (4 subgoals):
 1. tl (new_pre @ [x]) \<noteq> []
 2. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
 3. G.hitting_paths (last (new_pre @ [x]))
 4. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])
[PROOF STEP]
show "tl (new_pre @ [x]) \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
v0 \<leadsto>(new_pre @ [x])\<leadsto>\<^bsub>G\<^esub> last (new_pre @ [x])

goal (1 subgoal):
 1. tl (new_pre @ [x]) \<noteq> []
[PROOF STEP]
by (metis DisjointPaths.hitting_paths_def G.DisjointPaths_axioms G.path_from_toE
          butlast.simps(1) butlast_snoc list.distinct(1) list.sel(1) self_append_conv2
          tl_append2 x(1))
[PROOF STATE]
proof (state)
this:
tl (new_pre @ [x]) \<noteq> []

goal (3 subgoals):
 1. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
 2. G.hitting_paths (last (new_pre @ [x]))
 3. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
have "new_pre \<noteq> Nil"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. new_pre \<noteq> []
[PROOF STEP]
using G.hitting_paths_def P_new(1) P_new_decomp x(1)
[PROOF STATE]
proof (prove)
using this:
G.hitting_paths \<equiv> \<lambda>x. x \<noteq> v0 \<and> ((\<exists>xs\<in>paths. x \<in> set xs) \<or> x = v1)
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1
P_new = new_pre @ x # new_post
G.hitting_paths x

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

goal (3 subgoals):
 1. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
 2. G.hitting_paths (last (new_pre @ [x]))
 3. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
new_pre \<noteq> []
[PROOF STEP]
have "hd (tl (new_pre @ [x])) = hd (tl P_new)"
[PROOF STATE]
proof (prove)
using this:
new_pre \<noteq> []

goal (1 subgoal):
 1. hd (tl (new_pre @ [x])) = hd (tl P_new)
[PROOF STEP]
by (simp add: P_new_decomp hd_append)
[PROOF STATE]
proof (state)
this:
hd (tl (new_pre @ [x])) = hd (tl P_new)

goal (3 subgoals):
 1. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
 2. G.hitting_paths (last (new_pre @ [x]))
 3. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd (tl (new_pre @ [x])) = hd (tl P_new)
[PROOF STEP]
show "hd (tl (new_pre @ [x])) \<notin> G.second_vertices"
[PROOF STATE]
proof (prove)
using this:
hd (tl (new_pre @ [x])) = hd (tl P_new)

goal (1 subgoal):
 1. hd (tl (new_pre @ [x])) \<notin> G.second_vertices
[PROOF STEP]
by (metis P_new(2) P_new_decomp \<open>new_pre \<noteq> []\<close> append_is_Nil_conv disjoint_iff_not_equal
          list.distinct(1) list.set_sel(1) list.set_sel(2) tl_append2)
[PROOF STATE]
proof (state)
this:
hd (tl (new_pre @ [x])) \<notin> G.second_vertices

goal (2 subgoals):
 1. G.hitting_paths (last (new_pre @ [x]))
 2. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
show "G.hitting_paths (last (new_pre @ [x]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G.hitting_paths (last (new_pre @ [x]))
[PROOF STEP]
using x(1)
[PROOF STATE]
proof (prove)
using this:
G.hitting_paths x

goal (1 subgoal):
 1. G.hitting_paths (last (new_pre @ [x]))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G.hitting_paths (last (new_pre @ [x]))

goal (1 subgoal):
 1. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
show "\<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not>G.hitting_paths v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths v
[PROOF STEP]
by (simp add: x(2))
[PROOF STATE]
proof (state)
this:
?v \<in> set (butlast (new_pre @ [x])) \<Longrightarrow> \<not> G.hitting_paths ?v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
DisjointPathsPlusOne G v0 v1 paths (new_pre @ [x])

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
have 2: "NoSmallSeparationsInduct G v0 v1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NoSmallSeparationsInduct G v0 v1 n
[PROOF STEP]
by (simp add: G.v0_v1_Digraph_axioms NoSmallSeparationsInduct.intro
        NoSmallSeparationsInduct_axioms_def Suc.hyps Suc.prems(1))
[PROOF STATE]
proof (state)
this:
NoSmallSeparationsInduct G v0 v1 n

goal (1 subgoal):
 1. \<And>n G. \<lbrakk>\<And>G. \<lbrakk>\<And>S. Separation G v0 v1 S \<Longrightarrow> n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = n; \<And>S. Separation G v0 v1 S \<Longrightarrow> Suc n \<le> card S; v0_v1_Digraph G v0 v1\<rbrakk> \<Longrightarrow> \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n \<Longrightarrow> False
[PROOF STEP]
assume not_case: "\<not>?case"
[PROOF STATE]
proof (state)
this:
\<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n

goal (1 subgoal):
 1. \<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n \<Longrightarrow> False
[PROOF STEP]
have "x \<noteq> v1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> v1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
assume "x = v1"
[PROOF STATE]
proof (state)
this:
x = v1

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
define paths' where "paths' = insert P_new paths"
[PROOF STATE]
proof (state)
this:
paths' = insert P_new paths

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
paths' = insert P_new paths

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
fix xs v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
assume *: "xs \<in> paths" "v \<in> set xs" "v \<in> set P_new" "v \<noteq> v0" "v \<noteq> v1"
[PROOF STATE]
proof (state)
this:
xs \<in> paths
v \<in> set xs
v \<in> set P_new
v \<noteq> v0
v \<noteq> v1

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
have "v \<in> set new_pre"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> set new_pre
[PROOF STEP]
by (metis *(3,5) G.path_from_to_ends G.path_from_toE P_new(1) P_new_decomp
              \<open>x = v1\<close> butlast_snoc set_butlast)
[PROOF STATE]
proof (state)
this:
v \<in> set new_pre

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<in> set new_pre
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
v \<in> set new_pre

goal (1 subgoal):
 1. False
[PROOF STEP]
using *(1,2,4) G.hitting_paths_def x(2)
[PROOF STATE]
proof (prove)
using this:
v \<in> set new_pre
xs \<in> paths
v \<in> set xs
v \<noteq> v0
G.hitting_paths \<equiv> \<lambda>x. x \<noteq> v0 \<and> ((\<exists>xs\<in>paths. x \<in> set xs) \<or> x = v1)
?y \<in> set new_pre \<Longrightarrow> \<not> G.hitting_paths ?y

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

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?xs2 \<in> paths; ?v2 \<in> set ?xs2; ?v2 \<in> set P_new; ?v2 \<noteq> v0; ?v2 \<noteq> v1\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?xs2 \<in> paths; ?v2 \<in> set ?xs2; ?v2 \<in> set P_new; ?v2 \<noteq> v0; ?v2 \<noteq> v1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "DisjointPaths G v0 v1 paths'"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?xs2 \<in> paths; ?v2 \<in> set ?xs2; ?v2 \<in> set P_new; ?v2 \<noteq> v0; ?v2 \<noteq> v1\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. DisjointPaths G v0 v1 paths'
[PROOF STEP]
unfolding paths'_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?xs2 \<in> paths; ?v2 \<in> set ?xs2; ?v2 \<in> set P_new; ?v2 \<noteq> v0; ?v2 \<noteq> v1\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. DisjointPaths G v0 v1 (insert P_new paths)
[PROOF STEP]
using G.DisjointPaths_extend P_new(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?xs2 \<in> paths; ?v2 \<in> set ?xs2; ?v2 \<in> set P_new; ?v2 \<noteq> v0; ?v2 \<noteq> v1\<rbrakk> \<Longrightarrow> False
\<lbrakk>v0 \<leadsto>?P\<leadsto>\<^bsub>G\<^esub> v1; \<And>xs v. \<lbrakk>xs \<in> paths; xs \<noteq> ?P; v \<in> set xs; v \<in> set ?P\<rbrakk> \<Longrightarrow> v = v0 \<or> v = v1\<rbrakk> \<Longrightarrow> DisjointPaths G v0 v1 (insert ?P paths)
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1

goal (1 subgoal):
 1. DisjointPaths G v0 v1 (insert P_new paths)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
DisjointPaths G v0 v1 paths'

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
DisjointPaths G v0 v1 paths'

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
have "card paths' = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card paths' = Suc n
[PROOF STEP]
using P_new_new
[PROOF STATE]
proof (prove)
using this:
P_new \<notin> paths

goal (1 subgoal):
 1. card paths' = Suc n
[PROOF STEP]
by (simp add: G.finite_paths P(2) paths'_def)
[PROOF STATE]
proof (state)
this:
card paths' = Suc n

goal (1 subgoal):
 1. x = v1 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
DisjointPaths G v0 v1 paths'
card paths' = Suc n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
DisjointPaths G v0 v1 paths'
card paths' = Suc n

goal (1 subgoal):
 1. False
[PROOF STEP]
using not_case
[PROOF STATE]
proof (prove)
using this:
DisjointPaths G v0 v1 paths'
card paths' = Suc n
\<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<noteq> v1

goal (1 subgoal):
 1. \<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n \<Longrightarrow> False
[PROOF STEP]
have "ProofStepInduct_axioms paths n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ProofStepInduct_axioms paths n
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<noteq> 0
 2. card paths = n
[PROOF STEP]
show "n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0
[PROOF STEP]
using G.DisjointPaths_extend G.finite_paths P(2) P_new(1) not_case card_insert_disjoint
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>v0 \<leadsto>?P\<leadsto>\<^bsub>G\<^esub> v1; \<And>xs v. \<lbrakk>xs \<in> paths; xs \<noteq> ?P; v \<in> set xs; v \<in> set ?P\<rbrakk> \<Longrightarrow> v = v0 \<or> v = v1\<rbrakk> \<Longrightarrow> DisjointPaths G v0 v1 (insert ?P paths)
finite paths
card paths = n
v0 \<leadsto>P_new\<leadsto>\<^bsub>G\<^esub> v1
\<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> card (insert ?x ?A) = Suc (card ?A)

goal (1 subgoal):
 1. n \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. card paths = n
[PROOF STEP]
qed (insert P(2))
[PROOF STATE]
proof (state)
this:
ProofStepInduct_axioms paths n

goal (1 subgoal):
 1. \<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ProofStepInduct_axioms paths n
[PROOF STEP]
have "ProofStepInduct G v0 v1 paths (new_pre @ [x]) n"
[PROOF STATE]
proof (prove)
using this:
ProofStepInduct_axioms paths n

goal (1 subgoal):
 1. ProofStepInduct G v0 v1 paths (new_pre @ [x]) n
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
ProofStepInduct_axioms paths n
DisjointPathsPlusOne G v0 v1 paths (new_pre @ [x])
NoSmallSeparationsInduct G v0 v1 n

goal (1 subgoal):
 1. ProofStepInduct G v0 v1 paths (new_pre @ [x]) n
[PROOF STEP]
by (simp add: ProofStepInduct.intro)
[PROOF STATE]
proof (state)
this:
ProofStepInduct G v0 v1 paths (new_pre @ [x]) n

goal (1 subgoal):
 1. \<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ProofStepInduct G v0 v1 paths (new_pre @ [x]) n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
ProofStepInduct G v0 v1 paths (new_pre @ [x]) n

goal (1 subgoal):
 1. False
[PROOF STEP]
using ProofStepInduct.one_more_paths_exists not_case
[PROOF STATE]
proof (prove)
using this:
ProofStepInduct G v0 v1 paths (new_pre @ [x]) n
ProofStepInduct ?G ?v0.0 ?v1.0 ?paths ?P_new ?sep_size \<Longrightarrow> \<exists>paths. DisjointPaths ?G ?v0.0 ?v1.0 paths \<and> card paths = Suc ?sep_size
\<nexists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>paths. DisjointPaths G v0 v1 paths \<and> card paths = Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_on_homeomorphism:
  assumes "isometry_on X f"
  shows "homeomorphism X (f`X) f (inv_into X f)"
        "homeomorphism_on X f"
        "X homeomorphic f`X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism X (f ` X) f (inv_into X f) &&& homeomorphism_on X f &&& X homeomorphic f ` X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. homeomorphism X (f ` X) f (inv_into X f)
 2. homeomorphism_on X f
 3. X homeomorphic f ` X
[PROOF STEP]
show *: "homeomorphism X (f`X) f (inv_into X f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism X (f ` X) f (inv_into X f)
[PROOF STEP]
apply (rule homeomorphismI)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. continuous_on X f
 2. continuous_on (f ` X) (inv_into X f)
 3. f ` X \<subseteq> f ` X
 4. inv_into X f ` f ` X \<subseteq> X
 5. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 6. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
using uniformly_continuous_imp_continuous[OF isometry_on_uniformly_continuous]
    isometry_on_inverse[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
isometry_on ?s ?f \<Longrightarrow> continuous_on ?s ?f
isometry_on (f ` X) (inv_into X f)
?x \<in> X \<Longrightarrow> inv_into X f (f ?x) = ?x
?y \<in> f ` X \<Longrightarrow> f (inv_into X f ?y) = ?y
bij_betw f X (f ` X)
isometry_on X f

goal (6 subgoals):
 1. continuous_on X f
 2. continuous_on (f ` X) (inv_into X f)
 3. f ` X \<subseteq> f ` X
 4. inv_into X f ` f ` X \<subseteq> X
 5. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 6. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
homeomorphism X (f ` X) f (inv_into X f)

goal (2 subgoals):
 1. homeomorphism_on X f
 2. X homeomorphic f ` X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homeomorphism X (f ` X) f (inv_into X f)
[PROOF STEP]
show "X homeomorphic f`X"
[PROOF STATE]
proof (prove)
using this:
homeomorphism X (f ` X) f (inv_into X f)

goal (1 subgoal):
 1. X homeomorphic f ` X
[PROOF STEP]
unfolding homeomorphic_def
[PROOF STATE]
proof (prove)
using this:
homeomorphism X (f ` X) f (inv_into X f)

goal (1 subgoal):
 1. \<exists>fa g. homeomorphism X (f ` X) fa g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X homeomorphic f ` X

goal (1 subgoal):
 1. homeomorphism_on X f
[PROOF STEP]
show "homeomorphism_on X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism_on X f
[PROOF STEP]
unfolding homeomorphism_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ex (homeomorphism X (f ` X) f)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
homeomorphism X (f ` X) f (inv_into X f)

goal (1 subgoal):
 1. Ex (homeomorphism X (f ` X) f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
homeomorphism_on X f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mersenne_mod_nonneg_strong:
  \<open>mersenne_mod a p \<ge> 0\<close> if \<open>- (2 ^ p) + 1 < a\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> mersenne_mod a p
[PROOF STEP]
proof (cases \<open>a < 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
 2. \<not> a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a < 0

goal (2 subgoals):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
 2. \<not> a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
- (2 ^ p) + 1 < a
\<not> a < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- (2 ^ p) + 1 < a
\<not> a < 0

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

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a < 0

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
have \<open>- a div - (2 ^ p) = - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a div - (2 ^ p) = - 1
[PROOF STEP]
by (rule div_pos_neg_trivial) (use \<open>a < 0\<close> that in simp_all)
[PROOF STATE]
proof (state)
this:
- a div - (2 ^ p) = - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- a div - (2 ^ p) = - 1
[PROOF STEP]
have \<open>a div 2 ^ p = -1\<close>
[PROOF STATE]
proof (prove)
using this:
- a div - (2 ^ p) = - 1

goal (1 subgoal):
 1. a div 2 ^ p = - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a div 2 ^ p = - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a div 2 ^ p = - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
have \<open>- a mod - (2 ^ p) = - a + - (2 ^ p)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a mod - (2 ^ p) = - a + - (2 ^ p)
[PROOF STEP]
by (rule mod_pos_neg_trivial) (use \<open>a < 0\<close> that in simp_all)
[PROOF STATE]
proof (state)
this:
- a mod - (2 ^ p) = - a + - (2 ^ p)

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- a mod - (2 ^ p) = - a + - (2 ^ p)
[PROOF STEP]
have \<open>a mod 2 ^ p = a + 2 ^ p\<close>
[PROOF STATE]
proof (prove)
using this:
- a mod - (2 ^ p) = - a + - (2 ^ p)

goal (1 subgoal):
 1. a mod 2 ^ p = a + 2 ^ p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a mod 2 ^ p = a + 2 ^ p

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a div 2 ^ p = - 1
a mod 2 ^ p = a + 2 ^ p
[PROOF STEP]
have \<open>mersenne_mod a p = a + 2 ^ p - 1\<close>
[PROOF STATE]
proof (prove)
using this:
a div 2 ^ p = - 1
a mod 2 ^ p = a + 2 ^ p

goal (1 subgoal):
 1. mersenne_mod a p = a + 2 ^ p - 1
[PROOF STEP]
by (simp add: mersenne_mod_def)
[PROOF STATE]
proof (state)
this:
mersenne_mod a p = a + 2 ^ p - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mersenne_mod a p = a + 2 ^ p - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
have \<open>\<dots> > 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a + 2 ^ p - 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
- (2 ^ p) + 1 < a

goal (1 subgoal):
 1. 0 < a + 2 ^ p - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < a + 2 ^ p - 1

goal (1 subgoal):
 1. a < 0 \<Longrightarrow> 0 \<le> mersenne_mod a p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < mersenne_mod a p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < mersenne_mod a p

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monomial_ffact:
  "a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)"
    for a :: "'a :: comm_ring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ^ 0 = (\<Sum>k = 0..0. of_nat (Stirling 0 k) * ffact k a)
 2. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. a ^ 0 = (\<Sum>k = 0..0. of_nat (Stirling 0 k) * ffact k a)
 2. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ 0 = (\<Sum>k = 0..0. of_nat (Stirling 0 k) * ffact k a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a ^ 0 = (\<Sum>k = 0..0. of_nat (Stirling 0 k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)
[PROOF STEP]
have "a ^ Suc n = a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)"
[PROOF STATE]
proof (prove)
using this:
a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)

goal (1 subgoal):
 1. a ^ Suc n = a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a ^ Suc n = a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a ^ Suc n = a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) = (\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a))
[PROOF STEP]
by (simp add: sum_distrib_left algebra_simps)
[PROOF STATE]
proof (state)
this:
a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) = (\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a))

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) = (\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a))

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) +
    (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a)) = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a))
[PROOF STEP]
by (simp add: sum.distrib algebra_simps mult_ffact)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a)) = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (a * ffact k a)) = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0.. Suc n. of_nat (Stirling n k) * ffact (Suc k) a) +
    (\<Sum>k = 0..Suc n. of_nat ((Suc k) * (Stirling n (Suc k))) * (ffact (Suc k) a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
have "(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) =
      (\<Sum>k = 0..n+2. of_nat (Stirling n k) * (of_nat k * ffact k a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = Suc 0 .. Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a))
[PROOF STEP]
by (simp only: sum.atLeast_Suc_atMost [of 0 "n + 2"]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n + 2. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0 .. Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a))
[PROOF STEP]
by (simp only: image_Suc_atLeastAtMost sum.shift_bounds_cl_Suc_ivl)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0 .. Suc n. of_nat ((Suc k) * Stirling n (Suc k)) * ffact (Suc k) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
by (simp only: of_nat_mult algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
have "(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) =
      (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a) = (\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a)
[PROOF STEP]
by (simp add: algebra_simps sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a) = (\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..Suc n. of_nat (Stirling n k) * ffact (Suc k) a) + (\<Sum>k = 0..Suc n. of_nat (Suc k * Stirling n (Suc k)) * ffact (Suc k) a) = (\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a) = (\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
by (simp only: image_Suc_atLeastAtMost sum.shift_bounds_cl_Suc_ivl)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a) = (\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (Stirling (Suc n) (Suc k)) * ffact (Suc k) a) = (\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a) = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
by (simp only: sum.atLeast_Suc_atMost [of "0" "Suc n"]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a) = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)

goal (1 subgoal):
 1. \<And>n. a ^ n = (\<Sum>k = 0..n. of_nat (Stirling n k) * ffact k a) \<Longrightarrow> a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)

goal (1 subgoal):
 1. a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a ^ Suc n = (\<Sum>k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)

goal:
No subgoals!
[PROOF STEP]
qed