[STATEMENT]
theorem Gamma_integral_complex:
  assumes z: "Re z > 0"
  shows   "((\<lambda>t. of_real t powr (z - 1) / of_real (exp t)) has_integral Gamma z) {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have A: "((\<lambda>t. (of_real t) powr (z - 1) * of_real ((1 - t) ^ n))
          has_integral (fact n / pochhammer z (n+1))) {0..1}"
    if "Re z > 0" for n z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}
[PROOF STEP]
proof (induction n arbitrary: z)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ 0)) has_integral fact 0 / pochhammer z (0 + 1)) {0..1}
 2. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < Re z

goal (2 subgoals):
 1. \<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ 0)) has_integral fact 0 / pochhammer z (0 + 1)) {0..1}
 2. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
have "((\<lambda>t. complex_of_real t powr (z - 1)) has_integral
            (of_real 1 powr z / z - of_real 0 powr z / z)) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1)) has_integral complex_of_real 1 powr z / z - complex_of_real 0 powr z / z) {0..1}
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1)) has_integral complex_of_real 1 powr z / z - complex_of_real 0 powr z / z) {0..1}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus_interior)
         (auto intro!: continuous_intros derivative_eq_intros has_vector_derivative_real_field)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (z - 1)) has_integral complex_of_real 1 powr z / z - complex_of_real 0 powr z / z) {0..1}

goal (2 subgoals):
 1. \<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ 0)) has_integral fact 0 / pochhammer z (0 + 1)) {0..1}
 2. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. complex_of_real t powr (z - 1)) has_integral complex_of_real 1 powr z / z - complex_of_real 0 powr z / z) {0..1}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ 0)) has_integral fact 0 / pochhammer z (0 + 1)) {0..1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ 0)) has_integral fact 0 / pochhammer z (0 + 1)) {0..1}

goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < Re ?z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (?z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer ?z (n + 1)) {0..1}
0 < Re z

goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
let ?f = "\<lambda>t. complex_of_real t powr z / z"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
let ?f' = "\<lambda>t. complex_of_real t powr (z - 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
let ?g = "\<lambda>t. (1 - complex_of_real t) ^ Suc n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
let ?g' = "\<lambda>t. - ((1 - complex_of_real t) ^ n) * of_nat (Suc n)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
have "((\<lambda>t. ?f' t * ?g t) has_integral
            (of_nat (Suc n)) * fact n / pochhammer z (n+2)) {0..1}"
      (is "(_ has_integral ?I) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) * (1 - complex_of_real t) ^ Suc n) has_integral of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
proof (rule integration_by_parts_interior[where f' = ?f' and g = ?g])
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. continuous_on {0..1} ?f
 4. continuous_on {0..1} (\<lambda>t. (1 - complex_of_real t) ^ Suc n)
 5. \<And>t. t \<in> {0<..<1} \<Longrightarrow> (?f has_vector_derivative complex_of_real t powr (z - 1)) (at t)
 6. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 7. ((\<lambda>t. ?f t * ?g' t) has_integral ?f 1 * (1 - complex_of_real 1) ^ Suc n - ?f 0 * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
0 < Re z
[PROOF STEP]
show "continuous_on {0..1} ?f" "continuous_on {0..1} ?g"
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>t. complex_of_real t powr z / z) &&& continuous_on {0..1} (\<lambda>t. (1 - complex_of_real t) ^ Suc n)
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>t. complex_of_real t powr z / z)
continuous_on {0..1} (\<lambda>t. (1 - complex_of_real t) ^ Suc n)

goal (5 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
 4. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. complex_of_real t powr z / z * ?g' t) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
 4. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. complex_of_real t powr z / z * ?g' t) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
fix t :: real
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
 4. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. complex_of_real t powr z / z * ?g' t) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
assume t: "t \<in> {0<..<1}"
[PROOF STATE]
proof (state)
this:
t \<in> {0<..<1}

goal (5 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
 4. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. complex_of_real t powr z / z * ?g' t) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
show "(?f has_vector_derivative ?f' t) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
[PROOF STEP]
using t Suc.prems
[PROOF STATE]
proof (prove)
using this:
t \<in> {0<..<1}
0 < Re z

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)
[PROOF STEP]
by (auto intro!: derivative_eq_intros has_vector_derivative_real_field)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr z / z) has_vector_derivative complex_of_real t powr (z - 1)) (at t)

goal (4 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. \<And>t. t \<in> {0<..<1} \<Longrightarrow> ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative ?g' t) (at t)
 4. ((\<lambda>t. complex_of_real t powr z / z * ?g' t) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
show "(?g has_vector_derivative ?g' t) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative - ((1 - complex_of_real t) ^ n) * of_nat (Suc n)) (at t)
[PROOF STEP]
by (rule has_vector_derivative_real_field derivative_eq_intros refl)+ simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>t. (1 - complex_of_real t) ^ Suc n) has_vector_derivative - ((1 - complex_of_real t) ^ n) * of_nat (Suc n)) (at t)

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
0 < Re z
[PROOF STEP]
have [simp]: "z \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < Re z

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

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
0 < Re z
[PROOF STEP]
have A: "Re (z + of_nat n) > 0" for n
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. 0 < Re (z + of_nat n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Re (z + of_nat ?n)

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
have [simp]: "z + of_nat n \<noteq> 0" "z + 1 + of_nat n \<noteq> 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z + of_nat n \<noteq> 0 &&& z + 1 + of_nat n \<noteq> 0
[PROOF STEP]
using A[of n] A[of "Suc n"]
[PROOF STATE]
proof (prove)
using this:
0 < Re (z + of_nat n)
0 < Re (z + of_nat (Suc n))

goal (1 subgoal):
 1. z + of_nat n \<noteq> 0 &&& z + 1 + of_nat n \<noteq> 0
[PROOF STEP]
by (auto simp add: add.assoc simp del: plus_complex.sel)
[PROOF STATE]
proof (state)
this:
z + of_nat ?n \<noteq> 0
z + 1 + of_nat ?n \<noteq> 0

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
have "((\<lambda>x. of_real x powr z * of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) has_integral
              fact n / pochhammer (z+1) (n+1) * (- of_nat (Suc n) / z)) {0..1}"
        (is "(?A has_integral ?B) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) has_integral fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z)) {0..1}
[PROOF STEP]
using Suc.IH[of "z+1"] Suc.prems
[PROOF STATE]
proof (prove)
using this:
0 < Re (z + 1) \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z + 1 - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer (z + 1) (n + 1)) {0..1}
0 < Re z

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) has_integral fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z)) {0..1}
[PROOF STEP]
by (intro has_integral_mult_left) (simp_all add: add_ac pochhammer_rec)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) has_integral fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z)) {0..1}

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) has_integral fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z)) {0..1}

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
have "?A = (\<lambda>t. ?f t * ?g' t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) = (\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n)))
[PROOF STEP]
by (intro ext) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) = (\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n)))

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. complex_of_real x powr z * complex_of_real ((1 - x) ^ n) * (- of_nat (Suc n) / z)) = (\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n)))

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
have "?B = - (of_nat (Suc n) * fact n / pochhammer z (n+2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z) = - (of_nat (Suc n) * fact n / pochhammer z (n + 2))
[PROOF STEP]
by (simp add: field_split_simps pochhammer_rec
              prod.shift_bounds_cl_Suc_ivl del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
fact n / pochhammer (z + 1) (n + 1) * (- of_nat (Suc n) / z) = - (of_nat (Suc n) * fact n / pochhammer z (n + 2))

goal (3 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
 3. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. complex_of_real x powr z / z * (- ((1 - complex_of_real x) ^ n) * of_nat (Suc n))) has_integral - (of_nat (Suc n) * fact n / pochhammer z (n + 2))) {0..1}
[PROOF STEP]
show "((\<lambda>t. ?f t * ?g' t) has_integral (?f 1 * ?g 1 - ?f 0 * ?g 0 - ?I)) {0..1}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. complex_of_real x powr z / z * (- ((1 - complex_of_real x) ^ n) * of_nat (Suc n))) has_integral - (of_nat (Suc n) * fact n / pochhammer z (n + 2))) {0..1}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr z / z * (- ((1 - complex_of_real t) ^ n) * of_nat (Suc n))) has_integral complex_of_real 1 powr z / z * (1 - complex_of_real 1) ^ Suc n - complex_of_real 0 powr z / z * (1 - complex_of_real 0) ^ Suc n - of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}

goal (2 subgoals):
 1. bounded_bilinear (*)
 2. 0 \<le> 1
[PROOF STEP]
qed (simp_all add: bounded_bilinear_mult)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (z - 1) * (1 - complex_of_real t) ^ Suc n) has_integral of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}

goal (1 subgoal):
 1. \<And>n z. \<lbrakk>\<And>z. 0 < Re z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ n)) has_integral fact n / pochhammer z (n + 1)) {0..1}; 0 < Re z\<rbrakk> \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. complex_of_real t powr (z - 1) * (1 - complex_of_real t) ^ Suc n) has_integral of_nat (Suc n) * fact n / pochhammer z (n + 2)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (z - 1) * complex_of_real ((1 - t) ^ Suc n)) has_integral fact (Suc n) / pochhammer z (Suc n + 1)) {0..1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < Re ?z \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (?z - 1) * complex_of_real ((1 - t) ^ ?n)) has_integral fact ?n / pochhammer ?z (?n + 1)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have B: "((\<lambda>t. if t \<in> {0..of_nat n} then
             of_real t powr (z - 1) * (1 - of_real t / of_nat n) ^ n else 0)
           has_integral (of_nat n powr z * fact n / pochhammer z (n+1))) {0..}" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
case [simp]: True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
hence [simp]: "n \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < n

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

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
with has_integral_affinity01[OF A[OF z, of n], of "inverse (of_nat n)" 0]
[PROOF STATE]
proof (chain)
picking this:
inverse (real n) \<noteq> 0 \<Longrightarrow> ((\<lambda>x. complex_of_real (inverse (real n) * x + 0) powr (z - 1) * complex_of_real ((1 - (inverse (real n) * x + 0)) ^ n)) has_integral (1 / \<bar>inverse (real n)\<bar>) *\<^sub>R (fact n / pochhammer z (n + 1))) ((\<lambda>x. x / inverse (real n) - 0 / inverse (real n)) ` {0..1})
n \<noteq> 0
[PROOF STEP]
have "((\<lambda>x. (of_nat n - of_real x) ^ n * (of_real x / of_nat n) powr (z - 1) / of_nat n ^ n)
              has_integral fact n * of_nat n / pochhammer z (n+1)) ((\<lambda>x. real n * x)`{0..1})"
      (is "(?f has_integral ?I) ?ivl")
[PROOF STATE]
proof (prove)
using this:
inverse (real n) \<noteq> 0 \<Longrightarrow> ((\<lambda>x. complex_of_real (inverse (real n) * x + 0) powr (z - 1) * complex_of_real ((1 - (inverse (real n) * x + 0)) ^ n)) has_integral (1 / \<bar>inverse (real n)\<bar>) *\<^sub>R (fact n / pochhammer z (n + 1))) ((\<lambda>x. x / inverse (real n) - 0 / inverse (real n)) ` {0..1})
n \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) ((*) (real n) ` {0..1})
[PROOF STEP]
by (simp add: field_simps scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) ((*) (real n) ` {0..1})

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) ((*) (real n) ` {0..1})

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "((\<lambda>x. real n*x)`{0..1}) = {0..real n}"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (*) (real n) ` {0..1} = {0..real n}
[PROOF STEP]
by (subst image_mult_atLeastAtMost) simp_all
[PROOF STATE]
proof (state)
this:
(*) (real n) ` {0..1} = {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(*) (real n) ` {0..1} = {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "?f = (\<lambda>x. (of_real x / of_nat n) powr (z - 1) * (1 - of_real x / of_nat n) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) = (\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) = (\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n)
[PROOF STEP]
by (intro ext) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (of_nat n - complex_of_real x) ^ n * (complex_of_real x / of_nat n) powr (z - 1) / of_nat n ^ n) = (\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n)

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
have "((\<lambda>x. (of_real x / of_nat n) powr (z - 1) * (1 - of_real x / of_nat n) ^ n)
                    has_integral ?I) {0..real n}" (is ?P)
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (1 subgoal):
 1. ((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "?P \<longleftrightarrow> ((\<lambda>x. exp ((z - 1) * of_real (ln (x / of_nat n))) * (1 - of_real x / of_nat n) ^ n)
                        has_integral ?I) {0..real n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n} = ((\<lambda>x. exp ((z - 1) * complex_of_real (ln (x / real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
by (intro has_integral_spike_finite_eq[of "{0}"]) (auto simp: powr_def Ln_of_real [symmetric])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n} = ((\<lambda>x. exp ((z - 1) * complex_of_real (ln (x / real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (complex_of_real x / of_nat n) powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n} = ((\<lambda>x. exp ((z - 1) * complex_of_real (ln (x / real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ((\<lambda>x. exp ((z - 1) * of_real (ln x - ln (of_nat n))) * (1 - of_real x / of_nat n) ^ n)
                        has_integral ?I) {0..real n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp ((z - 1) * complex_of_real (ln (x / real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n} = ((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
by (intro has_integral_spike_finite_eq[of "{0}"]) (simp_all add: ln_div)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln (x / real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n} = ((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
have \<dots>
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (1 subgoal):
 1. ((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1)) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
note B = has_integral_mult_right[OF this, of "exp ((z - 1) * ln (of_nat n))"]
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * Ln (of_nat n)) * (exp ((z - 1) * complex_of_real (ln x - ln (real n))) * (1 - complex_of_real x / of_nat n) ^ n)) has_integral exp ((z - 1) * Ln (of_nat n)) * (fact n * of_nat n / pochhammer z (n + 1))) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "((\<lambda>x. exp ((z - 1) * of_real (ln x)) * (1 - of_real x / of_nat n) ^ n)
            has_integral (?I * exp ((z - 1) * ln (of_nat n)))) {0..real n}" (is ?P)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}
[PROOF STEP]
by (insert B, subst (asm) mult.assoc [symmetric], subst (asm) exp_add [symmetric])
         (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "?P \<longleftrightarrow> ((\<lambda>x. of_real x powr (z - 1) * (1 - of_real x / of_nat n) ^ n)
            has_integral (?I * exp ((z - 1) * ln (of_nat n)))) {0..real n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n} = ((\<lambda>x. complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}
[PROOF STEP]
by (intro has_integral_spike_finite_eq[of "{0}"]) (simp_all add: powr_def Ln_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n} = ((\<lambda>x. complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp ((z - 1) * complex_of_real (ln x)) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n} = ((\<lambda>x. complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n))) {0..real n}

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
have "fact n * of_nat n / pochhammer z (n+1) * exp ((z - 1) * Ln (of_nat n)) =
                 (of_nat n powr z * fact n / pochhammer z (n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n)) = of_nat n powr z * fact n / pochhammer z (n + 1)
[PROOF STEP]
by (auto simp add: powr_def algebra_simps exp_diff exp_of_real)
[PROOF STATE]
proof (state)
this:
fact n * of_nat n / pochhammer z (n + 1) * exp ((z - 1) * Ln (of_nat n)) = of_nat n powr z * fact n / pochhammer z (n + 1)

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
 2. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..real n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat n) ^ n) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..real n}

goal (1 subgoal):
 1. ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
by (subst has_integral_restrict) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < n

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < n

goal (1 subgoal):
 1. ((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}
[PROOF STEP]
by (subst has_integral_restrict) (simp_all add: has_integral_refl)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. if t \<in> {0..real n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat n) ^ n else 0) has_integral of_nat n powr z * fact n / pochhammer z (n + 1)) {0..}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>t. if t \<in> {0..real ?n} then complex_of_real t powr (z - 1) * (1 - complex_of_real t / of_nat ?n) ^ ?n else 0) has_integral of_nat ?n powr z * fact ?n / pochhammer z (?n + 1)) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have "eventually (\<lambda>n. Gamma_series z n =
          of_nat n powr z * fact n / pochhammer z (n+1)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. Gamma_series z n = of_nat n powr z * fact n / pochhammer z (n + 1)
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. Gamma_series z n = of_nat n powr z * fact n / pochhammer z (n + 1)
[PROOF STEP]
by eventually_elim (simp add: powr_def algebra_simps Gamma_series_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. Gamma_series z n = of_nat n powr z * fact n / pochhammer z (n + 1)

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
from this and Gamma_series_LIMSEQ[of z]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. Gamma_series z n = of_nat n powr z * fact n / pochhammer z (n + 1)
Gamma_series z \<longlonglongrightarrow> Gamma z
[PROOF STEP]
have C: "(\<lambda>k. of_nat k powr z * fact k / pochhammer z (k+1)) \<longlonglongrightarrow> Gamma z"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. Gamma_series z n = of_nat n powr z * fact n / pochhammer z (n + 1)
Gamma_series z \<longlonglongrightarrow> Gamma z

goal (1 subgoal):
 1. (\<lambda>k. of_nat k powr z * fact k / pochhammer z (k + 1)) \<longlonglongrightarrow> Gamma z
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. of_nat k powr z * fact k / pochhammer z (k + 1)) \<longlonglongrightarrow> Gamma z

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>k. of_nat k powr z * fact k / pochhammer z (k + 1)) \<longlonglongrightarrow> Gamma z

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
assume x: "x \<ge> 0"
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have lim_exp: "(\<lambda>k. (1 - x / real k) ^ k) \<longlonglongrightarrow> exp (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. (1 - x / real k) ^ k) \<longlonglongrightarrow> exp (- x)
[PROOF STEP]
using tendsto_exp_limit_sequentially[of "-x"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (1 + - x / real n) ^ n) \<longlonglongrightarrow> exp (- x)

goal (1 subgoal):
 1. (\<lambda>k. (1 - x / real k) ^ k) \<longlonglongrightarrow> exp (- x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>k. (1 - x / real k) ^ k) \<longlonglongrightarrow> exp (- x)

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have "(\<lambda>k. of_real x powr (z - 1) * of_real ((1 - x / of_nat k) ^ k))
            \<longlonglongrightarrow> of_real x powr (z - 1) * of_real (exp (-x))" (is ?P)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k)) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))
[PROOF STEP]
by (intro tendsto_intros lim_exp)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k)) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>k. complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k)) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
from eventually_gt_at_top[of "nat \<lceil>x\<rceil>"]
[PROOF STATE]
proof (chain)
picking this:
eventually ((<) (nat \<lceil>x\<rceil>)) sequentially
[PROOF STEP]
have "eventually (\<lambda>k. of_nat k > x) sequentially"
[PROOF STATE]
proof (prove)
using this:
eventually ((<) (nat \<lceil>x\<rceil>)) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F k in sequentially. x < real k
[PROOF STEP]
by eventually_elim linarith
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F k in sequentially. x < real k

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
hence "?P \<longleftrightarrow> (\<lambda>k. if x \<le> of_nat k then
                 of_real x powr (z - 1) * of_real ((1 - x / of_nat k) ^ k) else 0)
                   \<longlonglongrightarrow> of_real x powr (z - 1) * of_real (exp (-x))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F k in sequentially. x < real k

goal (1 subgoal):
 1. (\<lambda>k. complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k)) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x)) = (\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))
[PROOF STEP]
by (intro tendsto_cong) (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k)) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x)) = (\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))
[PROOF STEP]
have \<dots>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))

goal (1 subgoal):
 1. (\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>k. if x \<le> real k then complex_of_real x powr (z - 1) * complex_of_real ((1 - x / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) * complex_of_real (exp (- x))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 \<le> ?x2 \<Longrightarrow> (\<lambda>k. if ?x2 \<le> real k then complex_of_real ?x2 powr (z - 1) * complex_of_real ((1 - ?x2 / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real ?x2 powr (z - 1) * complex_of_real (exp (- ?x2))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
hence D: "\<forall>x\<in>{0..}. (\<lambda>k. if x \<in> {0..real k} then
              of_real x powr (z - 1) * (1 - of_real x / of_nat k) ^ k else 0)
             \<longlonglongrightarrow> of_real x powr (z - 1) / of_real (exp x)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?x2 \<Longrightarrow> (\<lambda>k. if ?x2 \<le> real k then complex_of_real ?x2 powr (z - 1) * complex_of_real ((1 - ?x2 / real k) ^ k) else 0) \<longlonglongrightarrow> complex_of_real ?x2 powr (z - 1) * complex_of_real (exp (- ?x2))

goal (1 subgoal):
 1. \<forall>x\<in>{0..}. (\<lambda>k. if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) / complex_of_real (exp x)
[PROOF STEP]
by (simp add: exp_minus field_simps cong: if_cong)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..}. (\<lambda>k. if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<longlonglongrightarrow> complex_of_real x powr (z - 1) / complex_of_real (exp x)

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have "((\<lambda>x. (Re z - 1) * (ln x / x)) \<longlongrightarrow> (Re z - 1) * 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (Re z - 1) * (ln x / x)) \<longlongrightarrow> (Re z - 1) * 0) at_top
[PROOF STEP]
by (intro tendsto_intros ln_x_over_x_tendsto_0)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (Re z - 1) * (ln x / x)) \<longlongrightarrow> (Re z - 1) * 0) at_top

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
hence "((\<lambda>x. ((Re z - 1) * ln x) / x) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (Re z - 1) * (ln x / x)) \<longlongrightarrow> (Re z - 1) * 0) at_top

goal (1 subgoal):
 1. ((\<lambda>x. (Re z - 1) * ln x / x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (Re z - 1) * ln x / x) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
from order_tendstoD(2)[OF this, of "1/2"]
[PROOF STATE]
proof (chain)
picking this:
0 < 1 / 2 \<Longrightarrow> \<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2
[PROOF STEP]
have "eventually (\<lambda>x. (Re z - 1) * ln x / x < 1/2) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < 1 / 2 \<Longrightarrow> \<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
from eventually_conj[OF this eventually_gt_at_top[of 0]]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2 \<and> 0 < x
[PROOF STEP]
obtain x0 where "\<forall>x\<ge>x0. (Re z - 1) * ln x / x < 1/2 \<and> x > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. (Re z - 1) * ln x / x < 1 / 2 \<and> 0 < x

goal (1 subgoal):
 1. (\<And>x0. \<forall>x\<ge>x0. (Re z - 1) * ln x / x < 1 / 2 \<and> 0 < x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>x0. (Re z - 1) * ln x / x < 1 / 2 \<and> 0 < x

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
hence x0: "x0 > 0" "\<And>x. x \<ge> x0 \<Longrightarrow> (Re z - 1) * ln x < x / 2"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>x0. (Re z - 1) * ln x / x < 1 / 2 \<and> 0 < x

goal (1 subgoal):
 1. 0 < x0 &&& (\<And>x. x0 \<le> x \<Longrightarrow> (Re z - 1) * ln x < x / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < x0
x0 \<le> ?x \<Longrightarrow> (Re z - 1) * ln ?x < ?x / 2

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
define h where "h = (\<lambda>x. if x \<in> {0..x0} then x powr (Re z - 1) else exp (-x/2))"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>x. if x \<in> {0..x0} then x powr (Re z - 1) else exp (- x / 2))

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have le_h: "x powr (Re z - 1) * exp (-x) \<le> h x" if x: "x \<ge> 0" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
proof (cases "x > x0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
 2. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x0 < x

goal (2 subgoals):
 1. x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
 2. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
from True x0(1)
[PROOF STATE]
proof (chain)
picking this:
x0 < x
0 < x0
[PROOF STEP]
have "x powr (Re z - 1) * exp (-x) = exp ((Re z - 1) * ln x - x)"
[PROOF STATE]
proof (prove)
using this:
x0 < x
0 < x0

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) = exp ((Re z - 1) * ln x - x)
[PROOF STEP]
by (simp add: powr_def exp_diff exp_minus field_simps exp_add)
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) = exp ((Re z - 1) * ln x - x)

goal (2 subgoals):
 1. x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
 2. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) = exp ((Re z - 1) * ln x - x)

goal (2 subgoals):
 1. x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
 2. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
from x0(2)[of x] True
[PROOF STATE]
proof (chain)
picking this:
x0 \<le> x \<Longrightarrow> (Re z - 1) * ln x < x / 2
x0 < x
[PROOF STEP]
have "\<dots> < exp (-x/2)"
[PROOF STATE]
proof (prove)
using this:
x0 \<le> x \<Longrightarrow> (Re z - 1) * ln x < x / 2
x0 < x

goal (1 subgoal):
 1. exp ((Re z - 1) * ln x - x) < exp (- x / 2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
exp ((Re z - 1) * ln x - x) < exp (- x / 2)

goal (2 subgoals):
 1. x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
 2. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x powr (Re z - 1) * exp (- x) < exp (- x / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x powr (Re z - 1) * exp (- x) < exp (- x / 2)

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x powr (Re z - 1) * exp (- x) < exp (- x / 2)
x0 < x

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
by (auto simp add: h_def)
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) \<le> h x

goal (1 subgoal):
 1. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x0 < x

goal (1 subgoal):
 1. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
have "x powr (Re z - 1) * exp (- x) \<le> x powr (Re z - 1) * 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> x powr (Re z - 1) * 1
[PROOF STEP]
by (intro mult_left_mono) simp_all
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) \<le> x powr (Re z - 1) * 1

goal (1 subgoal):
 1. \<not> x0 < x \<Longrightarrow> x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> x0 < x
x powr (Re z - 1) * exp (- x) \<le> x powr (Re z - 1) * 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> x0 < x
x powr (Re z - 1) * exp (- x) \<le> x powr (Re z - 1) * 1

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
by (auto simp add: h_def)
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) \<le> h x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> ?x \<Longrightarrow> ?x powr (Re z - 1) * exp (- ?x) \<le> h ?x

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have E: "\<forall>x\<in>{0..}. cmod (if x \<in> {0..real k} then of_real x powr (z - 1) *
                   (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x"
    (is "\<forall>x\<in>_. ?f x \<le> _") for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..}. cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
assume x: "x \<ge> 0"
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
fix x :: real and n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
assume x: "x \<le> of_nat n"
[PROOF STATE]
proof (state)
this:
x \<le> real n

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
have "(1 - complex_of_real x / of_nat n) = complex_of_real ((1 - x / of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - complex_of_real x / of_nat n = complex_of_real (1 - x / real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 - complex_of_real x / of_nat n = complex_of_real (1 - x / real n)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - complex_of_real x / of_nat n = complex_of_real (1 - x / real n)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
have "norm \<dots> = \<bar>(1 - x / real n)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (complex_of_real (1 - x / real n)) = \<bar>1 - x / real n\<bar>
[PROOF STEP]
by (subst norm_of_real) (rule refl)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real (1 - x / real n)) = \<bar>1 - x / real n\<bar>

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real (1 - x / real n)) = \<bar>1 - x / real n\<bar>

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<le> real n
[PROOF STEP]
have "\<dots> = (1 - x / real n)"
[PROOF STATE]
proof (prove)
using this:
x \<le> real n

goal (1 subgoal):
 1. \<bar>1 - x / real n\<bar> = 1 - x / real n
[PROOF STEP]
by (intro abs_of_nonneg) (simp_all add: field_split_simps)
[PROOF STATE]
proof (state)
this:
\<bar>1 - x / real n\<bar> = 1 - x / real n

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (1 - complex_of_real x / of_nat n) = 1 - x / real n
[PROOF STEP]
have "cmod (1 - complex_of_real x / of_nat n) = 1 - x / real n"
[PROOF STATE]
proof (prove)
using this:
cmod (1 - complex_of_real x / of_nat n) = 1 - x / real n

goal (1 subgoal):
 1. cmod (1 - complex_of_real x / of_nat n) = 1 - x / real n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (1 - complex_of_real x / of_nat n) = 1 - x / real n

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?xa2 \<le> real ?n2 \<Longrightarrow> cmod (1 - complex_of_real ?xa2 / of_nat ?n2) = 1 - ?xa2 / real ?n2

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
note D = this
[PROOF STATE]
proof (state)
this:
?xa2 \<le> real ?n2 \<Longrightarrow> cmod (1 - complex_of_real ?xa2 / of_nat ?n2) = 1 - ?xa2 / real ?n2

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
from D[of x k] x
[PROOF STATE]
proof (chain)
picking this:
x \<le> real k \<Longrightarrow> cmod (1 - complex_of_real x / of_nat k) = 1 - x / real k
0 \<le> x
[PROOF STEP]
have "?f x \<le> (if of_nat k \<ge> x \<and> k > 0 then x powr (Re z - 1) * (1 - x / real k) ^ k else 0)"
[PROOF STATE]
proof (prove)
using this:
x \<le> real k \<Longrightarrow> cmod (1 - complex_of_real x / of_nat k) = 1 - x / real k
0 \<le> x

goal (1 subgoal):
 1. cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> (if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0)
[PROOF STEP]
by (auto simp: norm_mult norm_powr_real_powr norm_power intro!: mult_nonneg_nonneg)
[PROOF STATE]
proof (state)
this:
cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> (if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> (if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
have "\<dots> \<le> x powr (Re z - 1) * exp  (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0) \<le> x powr (Re z - 1) * exp (- x)
[PROOF STEP]
by (auto intro!: mult_left_mono exp_ge_one_minus_x_over_n_power_n)
[PROOF STATE]
proof (state)
this:
(if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0) \<le> x powr (Re z - 1) * exp (- x)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if x \<le> real k \<and> 0 < k then x powr (Re z - 1) * (1 - x / real k) ^ k else 0) \<le> x powr (Re z - 1) * exp (- x)

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
have "\<dots> \<le> h x"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. x powr (Re z - 1) * exp (- x) \<le> h x
[PROOF STEP]
by (rule le_h)
[PROOF STATE]
proof (state)
this:
x powr (Re z - 1) * exp (- x) \<le> h x

goal (1 subgoal):
 1. \<And>x. 0 \<le> x \<Longrightarrow> cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
show "?f x \<le> h x"
[PROOF STATE]
proof (prove)
using this:
cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x

goal (1 subgoal):
 1. cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (if x \<in> {0..real k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat k) ^ k else 0) \<le> h x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..}. cmod (if x \<in> {0..real ?k} then complex_of_real x powr (z - 1) * (1 - complex_of_real x / of_nat ?k) ^ ?k else 0) \<le> h x

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
have F: "h integrable_on {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h integrable_on {0..}
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> {0..x0} then x powr (Re z - 1) else exp (- x / 2)) integrable_on {0..}
[PROOF STEP]
by (rule integrable_Gamma_integral_bound) (insert assms x0(1), simp_all)
[PROOF STATE]
proof (state)
this:
h integrable_on {0..}

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}
[PROOF STEP]
by (rule has_integral_dominated_convergence[OF B F E D C])
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t)) has_integral Gamma z) {0..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_take_nth:
  assumes "0 < i" and "i < length xs" and "xs ! (i - 1) \<le> y"
    and "sorted (take i xs)"
  shows "\<forall>x \<in> set (take i xs). x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (take i xs). x \<le> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>set (take i xs). x \<le> y
[PROOF STEP]
have "take i xs = take (i - 1) xs @ [xs ! (i - 1)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take i xs = take (i - 1) xs @ [xs ! (i - 1)]
[PROOF STEP]
using \<open>0 < i\<close> and \<open>i < length xs\<close>
[PROOF STATE]
proof (prove)
using this:
0 < i
i < length xs

goal (1 subgoal):
 1. take i xs = take (i - 1) xs @ [xs ! (i - 1)]
[PROOF STEP]
by (metis Suc_diff_1 less_imp_diff_less take_Suc_conv_app_nth)
[PROOF STATE]
proof (state)
this:
take i xs = take (i - 1) xs @ [xs ! (i - 1)]

goal (1 subgoal):
 1. \<forall>x\<in>set (take i xs). x \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take i xs = take (i - 1) xs @ [xs ! (i - 1)]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take i xs = take (i - 1) xs @ [xs ! (i - 1)]

goal (1 subgoal):
 1. \<forall>x\<in>set (take i xs). x \<le> y
[PROOF STEP]
using \<open>sorted (take i xs)\<close> and \<open>xs ! (i - 1) \<le>y\<close>
[PROOF STATE]
proof (prove)
using this:
take i xs = take (i - 1) xs @ [xs ! (i - 1)]
sorted (take i xs)
xs ! (i - 1) \<le> y

goal (1 subgoal):
 1. \<forall>x\<in>set (take i xs). x \<le> y
[PROOF STEP]
by (auto simp: sorted_append)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (take i xs). x \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sum_any_when_dependent_prod_left:
  "(\<Sum>(a, b). g b when a = h b) = (\<Sum>b. g b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(a, b). g b when a = h b) = Sum_any g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(a, b). g b when a = h b) = Sum_any g
[PROOF STEP]
have "(\<Sum>(a, b). g b when a = h b) = (\<Sum>(b, a). g b when a = h b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(a, b). g b when a = h b) = (\<Sum>(b, a). g b when a = h b)
[PROOF STEP]
by (rule Sum_any.reindex_cong [of prod.swap]) (simp_all add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>(a, b). g b when a = h b) = (\<Sum>(b, a). g b when a = h b)

goal (1 subgoal):
 1. (\<Sum>(a, b). g b when a = h b) = Sum_any g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(a, b). g b when a = h b) = (\<Sum>(b, a). g b when a = h b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(a, b). g b when a = h b) = (\<Sum>(b, a). g b when a = h b)

goal (1 subgoal):
 1. (\<Sum>(a, b). g b when a = h b) = Sum_any g
[PROOF STEP]
by (simp add: Sum_any_when_dependent_prod_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>(a, b). g b when a = h b) = Sum_any g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in v11) v11_vconverse_app_in_vdomain':
  assumes "y \<in>\<^sub>\<circ> \<R>\<^sub>\<circ> r" and "A = \<D>\<^sub>\<circ> r"
  shows "r\<inverse>\<^sub>\<circ>\<lparr>y\<rparr> \<in>\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<inverse>\<^sub>\<circ>\<lparr>y\<rparr> \<in>\<^sub>\<circ> A
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
y \<in>\<^sub>\<circ> \<R>\<^sub>\<circ> r

goal (1 subgoal):
 1. r\<inverse>\<^sub>\<circ>\<lparr>y\<rparr> \<in>\<^sub>\<circ> A
[PROOF STEP]
unfolding assms(2)
[PROOF STATE]
proof (prove)
using this:
y \<in>\<^sub>\<circ> \<R>\<^sub>\<circ> r

goal (1 subgoal):
 1. r\<inverse>\<^sub>\<circ>\<lparr>y\<rparr> \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> r
[PROOF STEP]
by (rule v11_vconverse_app_in_vdomain)


[STATEMENT]
lemma pochhammer_1 [simp]: "pochhammer a 1 = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer a 1 = a
[PROOF STEP]
by (simp add: pochhammer_prod lessThan_Suc)


[STATEMENT]
lemma map_upt_split: assumes i: "i < n"
  shows "map f [0 ..< n] = map f [0 ..< i] @ f i # map (\<lambda> j. f (j + Suc i)) [0 ..< n - Suc i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
i < n
[PROOF STEP]
have "n = i + Suc 0 + (n - Suc i)"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. n = i + Suc 0 + (n - Suc i)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
n = i + Suc 0 + (n - Suc i)

goal (1 subgoal):
 1. map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
hence id: "[0 ..< n] = [0 ..< i + Suc 0 + (n - Suc i)]"
[PROOF STATE]
proof (prove)
using this:
n = i + Suc 0 + (n - Suc i)

goal (1 subgoal):
 1. [0..<n] = [0..<i + Suc 0 + (n - Suc i)]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<n] = [0..<i + Suc 0 + (n - Suc i)]

goal (1 subgoal):
 1. map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f [0..<i + Suc 0 + (n - Suc i)] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
unfolding map_upt_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f [0..<i] @ map (\<lambda>ia. f (ia + i)) [0..<Suc 0]) @ map (\<lambda>ia. f (ia + (i + Suc 0))) [0..<n - Suc i] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map f [0..<n] = map f [0..<i] @ f i # map (\<lambda>j. f (j + Suc i)) [0..<n - Suc i]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma front_tickFree_append: "\<lbrakk> tickFree s; front_tickFree t\<rbrakk> \<Longrightarrow> front_tickFree (s @ t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>tickFree s; front_tickFree t\<rbrakk> \<Longrightarrow> front_tickFree (s @ t)
[PROOF STEP]
apply(drule front_tickFree_charn[THEN iffD1], auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>tickFree s; t = []\<rbrakk> \<Longrightarrow> front_tickFree s
 2. \<And>a ta. \<lbrakk>tickFree s; tickFree ta; t = ta @ [a]\<rbrakk> \<Longrightarrow> front_tickFree (s @ ta @ [a])
[PROOF STEP]
apply(erule tickFree_implies_front_tickFree)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ta. \<lbrakk>tickFree s; tickFree ta; t = ta @ [a]\<rbrakk> \<Longrightarrow> front_tickFree (s @ ta @ [a])
[PROOF STEP]
apply(subst append_assoc[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ta. \<lbrakk>tickFree s; tickFree ta; t = ta @ [a]\<rbrakk> \<Longrightarrow> front_tickFree ((s @ ta) @ [a])
[PROOF STEP]
apply(rule tickFree_implies_front_tickFree_single)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ta. \<lbrakk>tickFree s; tickFree ta; t = ta @ [a]\<rbrakk> \<Longrightarrow> tickFree (s @ ta)
[PROOF STEP]
apply(auto intro: tickFree_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ang_vec_opposite2:
  assumes "z2 \<noteq> 0"
  shows "\<angle> z1 (-z2) = \<downharpoonright>\<angle> z1 z2 + pi\<downharpoonleft>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<angle> z1 (- z2) = \<downharpoonright>\<angle> z1 z2 + pi\<downharpoonleft>
[PROOF STEP]
unfolding ang_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
using arg_mult[of "-1" "z2"] assms
[PROOF STATE]
proof (prove)
using this:
- 1 * z2 \<noteq> 0 \<Longrightarrow> Arg (- 1 * z2) = \<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft>
z2 \<noteq> 0

goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
using arg_complex_of_real_negative[of "-1"]
[PROOF STATE]
proof (prove)
using this:
- 1 * z2 \<noteq> 0 \<Longrightarrow> Arg (- 1 * z2) = \<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft>
z2 \<noteq> 0
- 1 < 0 \<Longrightarrow> Arg (cor (- 1)) = pi

goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
using canon_ang_diff[of "Arg (-1) + Arg z2" "Arg z1", symmetric]
[PROOF STATE]
proof (prove)
using this:
- 1 * z2 \<noteq> 0 \<Longrightarrow> Arg (- 1 * z2) = \<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft>
z2 \<noteq> 0
- 1 < 0 \<Longrightarrow> Arg (cor (- 1)) = pi
\<downharpoonright>\<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft> - \<downharpoonright>Arg z1\<downharpoonleft>\<downharpoonleft> = \<downharpoonright>Arg (- 1) + Arg z2 - Arg z1\<downharpoonleft>

goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
using canon_ang_sum[of "Arg z2 - Arg z1" "pi", symmetric]
[PROOF STATE]
proof (prove)
using this:
- 1 * z2 \<noteq> 0 \<Longrightarrow> Arg (- 1 * z2) = \<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft>
z2 \<noteq> 0
- 1 < 0 \<Longrightarrow> Arg (cor (- 1)) = pi
\<downharpoonright>\<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft> - \<downharpoonright>Arg z1\<downharpoonleft>\<downharpoonleft> = \<downharpoonright>Arg (- 1) + Arg z2 - Arg z1\<downharpoonleft>
\<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + \<downharpoonright>pi\<downharpoonleft>\<downharpoonleft> = \<downharpoonright>Arg z2 - Arg z1 + pi\<downharpoonleft>

goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
using canon_ang_id[of pi] canon_ang_arg[of z1]
[PROOF STATE]
proof (prove)
using this:
- 1 * z2 \<noteq> 0 \<Longrightarrow> Arg (- 1 * z2) = \<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft>
z2 \<noteq> 0
- 1 < 0 \<Longrightarrow> Arg (cor (- 1)) = pi
\<downharpoonright>\<downharpoonright>Arg (- 1) + Arg z2\<downharpoonleft> - \<downharpoonright>Arg z1\<downharpoonleft>\<downharpoonleft> = \<downharpoonright>Arg (- 1) + Arg z2 - Arg z1\<downharpoonleft>
\<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + \<downharpoonright>pi\<downharpoonleft>\<downharpoonleft> = \<downharpoonright>Arg z2 - Arg z1 + pi\<downharpoonleft>
- pi < pi \<and> pi \<le> pi \<Longrightarrow> \<downharpoonright>pi\<downharpoonleft> = pi
\<downharpoonright>Arg z1\<downharpoonleft> = Arg z1

goal (1 subgoal):
 1. \<downharpoonright>Arg (- z2) - Arg z1\<downharpoonleft> = \<downharpoonright>\<downharpoonright>Arg z2 - Arg z1\<downharpoonleft> + pi\<downharpoonleft>
[PROOF STEP]
by (auto simp: algebra_simps)


[STATEMENT]
lemma neg_mask_diff_bound:
  "sz'\<le> sz \<Longrightarrow> (ptr AND NOT(mask sz')) - (ptr AND NOT(mask sz)) \<le> 2 ^ sz - 2 ^ sz'"
  (is "_ \<Longrightarrow> ?lhs \<le> ?rhs")
  for ptr :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
assume lt: "sz' \<le> sz"
[PROOF STATE]
proof (state)
this:
sz' \<le> sz

goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
hence "?lhs = ptr AND (mask sz AND NOT(mask sz'))"
[PROOF STATE]
proof (prove)
using this:
sz' \<le> sz

goal (1 subgoal):
 1. (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) = ptr AND mask sz AND NOT (mask sz')
[PROOF STEP]
by (metis add_diff_cancel_left' multiple_mask_trivia)
[PROOF STATE]
proof (state)
this:
(ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) = ptr AND mask sz AND NOT (mask sz')

goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) = ptr AND mask sz AND NOT (mask sz')

goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
have "\<dots> \<le> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ptr AND mask sz AND NOT (mask sz') \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
using lt
[PROOF STATE]
proof (prove)
using this:
sz' \<le> sz

goal (1 subgoal):
 1. ptr AND mask sz AND NOT (mask sz') \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
by (metis (mono_tags) add_diff_eq diff_eq_eq eq_iff mask_2pm1 mask_sub word_and_le')
[PROOF STATE]
proof (state)
this:
ptr AND mask sz AND NOT (mask sz') \<le> 2 ^ sz - 2 ^ sz'

goal (1 subgoal):
 1. sz' \<le> sz \<Longrightarrow> (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'

goal (1 subgoal):
 1. (ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(ptr AND NOT (mask sz')) - (ptr AND NOT (mask sz)) \<le> 2 ^ sz - 2 ^ sz'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vertical_composite_inverse_iso [simp]:
  assumes "natural_isomorphism A B F G \<tau>"
  shows "vertical_composite.map A B (inverse_transformation.map A B G \<tau>) \<tau> = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertical_composite.map A B (inverse_transformation.map A B G \<tau>) \<tau> = G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B (inverse_transformation.map A B G \<tau>) \<tau> = G
[PROOF STEP]
interpret \<tau>: natural_isomorphism A B F G \<tau>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natural_isomorphism A B F G \<tau>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
natural_isomorphism A B F G \<tau>

goal (1 subgoal):
 1. natural_isomorphism A B F G \<tau>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B (inverse_transformation.map A B G \<tau>) \<tau> = G
[PROOF STEP]
interpret \<tau>': inverse_transformation A B F G \<tau>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_transformation A B F G \<tau>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B \<tau>'.map \<tau> = G
[PROOF STEP]
interpret \<tau>'\<tau>: vertical_composite A B G F G \<tau>'.map \<tau>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertical_composite A B G F G \<tau>'.map \<tau>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<tau>'\<tau>.map = G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau>'\<tau>.map = G
[PROOF STEP]
using \<tau>'\<tau>.is_natural_transformation \<tau>.G.as_nat_trans.natural_transformation_axioms
            \<tau>'.inverts_components \<tau>'\<tau>.map_simp_ide \<tau>.B.comp_arr_inv
[PROOF STATE]
proof (prove)
using this:
natural_transformation A B G G \<tau>'\<tau>.map
natural_transformation A B G G G
\<tau>.A.ide ?a \<Longrightarrow> \<tau>.B.inverse_arrows (\<tau> ?a) (\<tau>'.map ?a)
\<tau>.A.ide ?a \<Longrightarrow> \<tau>'\<tau>.map ?a = B (\<tau> ?a) (\<tau>'.map ?a)
\<tau>.B.inverse_arrows ?f ?g \<Longrightarrow> B ?f ?g = \<tau>.B.dom ?g

goal (1 subgoal):
 1. \<tau>'\<tau>.map = G
[PROOF STEP]
by (intro eqI, auto)
[PROOF STATE]
proof (state)
this:
\<tau>'\<tau>.map = G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_int_rat_division :
  assumes "y \<noteq> 0"
  shows "is_int_rat (rat_of_int x / rat_of_int y) \<longleftrightarrow> x mod y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_int_rat (rat_of_int x / rat_of_int y) = (x mod y = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
assume "is_int_rat (rat_of_int x / rat_of_int y)"
[PROOF STATE]
proof (state)
this:
is_int_rat (rat_of_int x / rat_of_int y)

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
obtain v where v_def:"rat_of_int v = rat_of_int x / rat_of_int y"
[PROOF STATE]
proof (prove)
using this:
is_int_rat (rat_of_int x / rat_of_int y)

goal (1 subgoal):
 1. (\<And>v. rat_of_int v = rat_of_int x / rat_of_int y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using int_of_rat(2) is_int_rat
[PROOF STATE]
proof (prove)
using this:
is_int_rat (rat_of_int x / rat_of_int y)
?z \<in> \<int> \<Longrightarrow> rat_of_int (int_of_rat ?z) = ?z
is_int_rat ?x = (?x \<in> \<int>)

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

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
hence "v = \<lfloor>rat_of_int x / rat_of_int y\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
rat_of_int v = rat_of_int x / rat_of_int y

goal (1 subgoal):
 1. v = \<lfloor>rat_of_int x / rat_of_int y\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
v = \<lfloor>rat_of_int x / rat_of_int y\<rfloor>

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
hence "v * y = x - x mod y"
[PROOF STATE]
proof (prove)
using this:
v = \<lfloor>rat_of_int x / rat_of_int y\<rfloor>

goal (1 subgoal):
 1. v * y = x - x mod y
[PROOF STEP]
using div_is_floor_divide_rat mod_div_equality_int
[PROOF STATE]
proof (prove)
using this:
v = \<lfloor>rat_of_int x / rat_of_int y\<rfloor>
?n div ?y = \<lfloor>rat_of_int ?n / rat_of_int ?y\<rfloor>
?n div ?x * ?x = ?n - ?n mod ?x

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

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
hence "rat_of_int v * rat_of_int y = rat_of_int x - rat_of_int (x mod y)"
[PROOF STATE]
proof (prove)
using this:
v * y = x - x mod y

goal (1 subgoal):
 1. rat_of_int v * rat_of_int y = rat_of_int x - rat_of_int (x mod y)
[PROOF STEP]
by (fold hom_distribs, unfold of_int_hom.eq_iff)
[PROOF STATE]
proof (state)
this:
rat_of_int v * rat_of_int y = rat_of_int x - rat_of_int (x mod y)

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
hence "(rat_of_int x / rat_of_int y) * rat_of_int y = rat_of_int x - rat_of_int (x mod y)"
[PROOF STATE]
proof (prove)
using this:
rat_of_int v * rat_of_int y = rat_of_int x - rat_of_int (x mod y)

goal (1 subgoal):
 1. rat_of_int x / rat_of_int y * rat_of_int y = rat_of_int x - rat_of_int (x mod y)
[PROOF STEP]
using v_def
[PROOF STATE]
proof (prove)
using this:
rat_of_int v * rat_of_int y = rat_of_int x - rat_of_int (x mod y)
rat_of_int v = rat_of_int x / rat_of_int y

goal (1 subgoal):
 1. rat_of_int x / rat_of_int y * rat_of_int y = rat_of_int x - rat_of_int (x mod y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rat_of_int x / rat_of_int y * rat_of_int y = rat_of_int x - rat_of_int (x mod y)

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
hence "rat_of_int x = rat_of_int x - rat_of_int (x mod y)"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x / rat_of_int y * rat_of_int y = rat_of_int x - rat_of_int (x mod y)

goal (1 subgoal):
 1. rat_of_int x = rat_of_int x - rat_of_int (x mod y)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
rat_of_int x = rat_of_int x - rat_of_int (x mod y)

goal (2 subgoals):
 1. is_int_rat (rat_of_int x / rat_of_int y) \<Longrightarrow> x mod y = 0
 2. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
thus "x mod y = 0"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x = rat_of_int x - rat_of_int (x mod y)

goal (1 subgoal):
 1. x mod y = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x mod y = 0

goal (1 subgoal):
 1. x mod y = 0 \<Longrightarrow> is_int_rat (rat_of_int x / rat_of_int y)
[PROOF STEP]
qed (force)