[STATEMENT]
lemma sylvester_sub_poly:
  fixes p q :: "'a :: comm_semiring_0 poly"
  assumes m: "degree p \<le> m"
  assumes n: "degree q \<le> n"
  assumes v: "v \<in> carrier_vec (m+n)"
  shows "poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) =
    poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) = poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q
[PROOF STEP]
proof (rule poly_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) na = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) na
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) na = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) na
[PROOF STEP]
let ?Tv = "(sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) na = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) na
[PROOF STEP]
have dim: "dim_vec (vec_first v n) = n" "dim_vec (vec_last v m) = m" "dim_vec ?Tv = n + m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_first v n) = n &&& dim_vec (vec_last v m) = m &&& dim_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) = n + m
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec (m + n)

goal (1 subgoal):
 1. dim_vec (vec_first v n) = n &&& dim_vec (vec_last v m) = m &&& dim_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) = n + m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec (vec_first v n) = n
dim_vec (vec_last v m) = m
dim_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) = n + m

goal (1 subgoal):
 1. \<And>na. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) na = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) na
[PROOF STEP]
have if_distrib: "\<And> x y z. (if x then y else (0 :: 'a)) * z = (if x then y * z else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. (if x then y else (0::'a)) * z = (if x then y * z else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if ?x then ?y else (0::'a)) * ?z = (if ?x then ?y * ?z else (0::'a))

goal (1 subgoal):
 1. \<And>na. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) na = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) na
[PROOF STEP]
show "coeff ?l i = coeff ?r i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
proof (cases "i < m+n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> i < m + n

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence i_mn: "i \<ge> m+n"
        and i_n: "\<And>x. x \<le> i \<and> x < n \<longleftrightarrow> x < n"
        and i_m: "\<And>x. x \<le> i \<and> x < m \<longleftrightarrow> x < m"
[PROOF STATE]
proof (prove)
using this:
\<not> i < m + n

goal (1 subgoal):
 1. m + n \<le> i &&& (\<And>x. (x \<le> i \<and> x < n) = (x < n)) &&& (\<And>x. (x \<le> i \<and> x < m) = (x < m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m + n \<le> i
(?x \<le> i \<and> ?x < n) = (?x < n)
(?x \<le> i \<and> ?x < m) = (?x < m)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "coeff ?r i =
            (\<Sum> x < n. vec_first v n $ (n - Suc x) * coeff p (i - x)) +
            (\<Sum> x < m. vec_last v m $ (m - Suc x) * coeff q (i - x))"
        (is "_ = sum ?f _ + sum ?g _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding coeff_add coeff_mult Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<le>i. coeff (poly_of_vec (vec_first v n)) ia * coeff p (i - ia)) + (\<Sum>ia\<le>i. coeff (poly_of_vec (vec_last v m)) ia * coeff q (i - ia)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding coeff_poly_of_vec dim if_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<le>i. if ia < n then vec_first v n $ (n - Suc ia) * coeff p (i - ia) else (0::'a)) + (\<Sum>ia\<le>i. if ia < m then vec_last v m $ (m - Suc ia) * coeff q (i - ia) else (0::'a)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding atMost_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x. x \<le> i}. if ia < n then vec_first v n $ (n - Suc ia) * coeff p (i - ia) else (0::'a)) + (\<Sum>ia\<in>{x. x \<le> i}. if ia < m then vec_last v m $ (m - Suc ia) * coeff q (i - ia) else (0::'a)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
apply(subst sum.inter_filter[symmetric],simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x \<in> {x. x \<le> i}. x < n}. vec_first v n $ (n - Suc ia) * coeff p (i - ia)) + (\<Sum>ia\<in>{x. x \<le> i}. if ia < m then vec_last v m $ (m - Suc ia) * coeff q (i - ia) else (0::'a)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
apply(subst sum.inter_filter[symmetric],simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x \<in> {x. x \<le> i}. x < n}. vec_first v n $ (n - Suc ia) * coeff p (i - ia)) + (\<Sum>ia\<in>{x \<in> {x. x \<le> i}. x < m}. vec_last v m $ (m - Suc ia) * coeff q (i - ia)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x. x \<le> i \<and> x < n}. vec_first v n $ (n - Suc ia) * coeff p (i - ia)) + (\<Sum>ia\<in>{x. x \<le> i \<and> x < m}. vec_last v m $ (m - Suc ia) * coeff q (i - ia)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding i_n i_m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x. x < n}. vec_first v n $ (n - Suc ia) * coeff p (i - ia)) + (\<Sum>ia\<in>{x. x < m}. vec_last v m $ (m - Suc ia) * coeff q (i - ia)) = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
unfolding lessThan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia\<in>{x. x < n}. vec_first v n $ (n - Suc ia) * coeff p (i - ia)) + (\<Sum>ia\<in>{x. x < m}. vec_last v m $ (m - Suc ia) * coeff q (i - ia)) = (\<Sum>x | x < n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x | x < m. vec_last v m $ (m - Suc x) * coeff q (i - x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) + (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x))

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
assume x: "x < n"
[PROOF STATE]
proof (state)
this:
x < n

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "coeff p (i-x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff p (i - x) = (0::'a)
[PROOF STEP]
apply(rule coeff_eq_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p < i - x
[PROOF STEP]
using i_mn x m
[PROOF STATE]
proof (prove)
using this:
m + n \<le> i
x < n
degree p \<le> m

goal (1 subgoal):
 1. degree p < i - x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff p (i - x) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence "?f x = 0"
[PROOF STATE]
proof (prove)
using this:
coeff p (i - x) = (0::'a)

goal (1 subgoal):
 1. vec_first v n $ (n - Suc x) * coeff p (i - x) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_first v n $ (n - Suc x) * coeff p (i - x) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 < n \<Longrightarrow> vec_first v n $ (n - Suc ?x2) * coeff p (i - ?x2) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence "sum ?f {..<n} = 0"
[PROOF STATE]
proof (prove)
using this:
?x2 < n \<Longrightarrow> vec_first v n $ (n - Suc ?x2) * coeff p (i - ?x2) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>x<n. vec_first v n $ (n - Suc x) * coeff p (i - x)) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
assume x: "x < m"
[PROOF STATE]
proof (state)
this:
x < m

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "coeff q (i-x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff q (i - x) = (0::'a)
[PROOF STEP]
apply(rule coeff_eq_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree q < i - x
[PROOF STEP]
using i_mn x n
[PROOF STATE]
proof (prove)
using this:
m + n \<le> i
x < m
degree q \<le> n

goal (1 subgoal):
 1. degree q < i - x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff q (i - x) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence "?g x = 0"
[PROOF STATE]
proof (prove)
using this:
coeff q (i - x) = (0::'a)

goal (1 subgoal):
 1. vec_last v m $ (m - Suc x) * coeff q (i - x) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_last v m $ (m - Suc x) * coeff q (i - x) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 < m \<Longrightarrow> vec_last v m $ (m - Suc ?x2) * coeff q (i - ?x2) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence "sum ?g {..<m} = 0"
[PROOF STATE]
proof (prove)
using this:
?x2 < m \<Longrightarrow> vec_last v m $ (m - Suc ?x2) * coeff q (i - ?x2) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x)) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x<m. vec_last v m $ (m - Suc x) * coeff q (i - x)) = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (0::'a) + (0::'a)
[PROOF STEP]
have "coeff ?r i = 0"
[PROOF STATE]
proof (prove)
using this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (0::'a) + (0::'a)

goal (1 subgoal):
 1. coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = (0::'a)

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> i < m + n
[PROOF STEP]
have "0 = coeff ?l i"
[PROOF STATE]
proof (prove)
using this:
\<not> i < m + n

goal (1 subgoal):
 1. (0::'a) = coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i
[PROOF STEP]
unfolding coeff_poly_of_vec dim sum.distrib[symmetric]
[PROOF STATE]
proof (prove)
using this:
\<not> i < m + n

goal (1 subgoal):
 1. (0::'a) = (if i < n + m then ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i) else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) = coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i

goal (2 subgoals):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
 2. \<not> i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i = coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i

goal (1 subgoal):
 1. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i < m + n

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
hence "coeff ?l i = ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i)"
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (1 subgoal):
 1. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i)
[PROOF STEP]
unfolding coeff_poly_of_vec dim sum.distrib[symmetric]
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (1 subgoal):
 1. (if i < n + m then ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i) else (0::'a)) = ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i)

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i)

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "... = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(subst index_mult_mat_vec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n + m - Suc i < dim_row (sylvester_mat_sub m n p q)\<^sup>T
 2. row (sylvester_mat_sub m n p q)\<^sup>T (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. n + m - Suc i < dim_row (sylvester_mat_sub m n p q)\<^sup>T
 2. row (sylvester_mat_sub m n p q)\<^sup>T (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (sylvester_mat_sub m n p q)\<^sup>T (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(subst row_transpose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n + m - Suc i < dim_col (sylvester_mat_sub m n p q)
 2. col (sylvester_mat_sub m n p q) (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. n + m - Suc i < dim_col (sylvester_mat_sub m n p q)
 2. col (sylvester_mat_sub m n p q) (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (sylvester_mat_sub m n p q) (n + m - Suc i) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(subst col_sylvester_sub)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n + m - Suc i < m + n
 2. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. n + m - Suc i < m + n
 2. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> v = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(subst vec_first_last_append[of v n m,symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. v \<in> carrier_vec (n + m)
 2. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> (vec_first v n @\<^sub>v vec_last v m) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec (m + n)

goal (2 subgoals):
 1. v \<in> carrier_vec (n + m)
 2. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> (vec_first v n @\<^sub>v vec_last v m) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(simp add: add.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i)) \<bullet> (vec_first v n @\<^sub>v vec_last v m) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply(subst scalar_prod_append)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) \<in> carrier_vec ?n1.55
 2. Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<in> carrier_vec ?n2.55
 3. vec_first v n \<in> carrier_vec ?n1.55
 4. vec_last v m \<in> carrier_vec ?n2.55
 5. Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) \<bullet> vec_first v n + Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply (rule carrier_vecI,simp)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Missing_Lemmas.vec_of_poly_rev_shifted p n m (n + m - Suc i) \<bullet> vec_first v n + Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply (subst vec_of_poly_rev_shifted_scalar_prod[OF m],simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i < m + n
 2. coeff (p * poly_of_vec (vec_first v n)) i + Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. i < m + n
 2. coeff (p * poly_of_vec (vec_first v n)) i + Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n)) i + Missing_Lemmas.vec_of_poly_rev_shifted q m n (n + m - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply (subst add.commute[of n m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n)) i + Missing_Lemmas.vec_of_poly_rev_shifted q m n (m + n - Suc i) \<bullet> vec_last v m = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply (subst vec_of_poly_rev_shifted_scalar_prod[OF n])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. dim_vec (vec_last v m) = m
 2. i < n + m
 3. coeff (p * poly_of_vec (vec_first v n)) i + coeff (q * poly_of_vec (vec_last v m)) i = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i < n + m
 2. coeff (p * poly_of_vec (vec_first v n)) i + coeff (q * poly_of_vec (vec_last v m)) i = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. i < n + m
 2. coeff (p * poly_of_vec (vec_first v n)) i + coeff (q * poly_of_vec (vec_last v m)) i = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n)) i + coeff (q * poly_of_vec (vec_last v m)) i = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v) $ (n + m - Suc i) = coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "... =
        (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else 0) * coeff p (i - x)) +
        (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else 0) * coeff q (i - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x))
[PROOF STEP]
unfolding coeff_poly_of_vec[of "vec_first v n",unfolded dim_vec_first,symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = (\<Sum>x\<le>i. coeff (poly_of_vec (vec_first v n)) x * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x))
[PROOF STEP]
unfolding coeff_poly_of_vec[of "vec_last v m",unfolded dim_vec_last,symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = (\<Sum>x\<le>i. coeff (poly_of_vec (vec_first v n)) x * coeff p (i - x)) + (\<Sum>x\<le>i. coeff (poly_of_vec (vec_last v m)) x * coeff q (i - x))
[PROOF STEP]
unfolding coeff_mult[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = coeff (poly_of_vec (vec_first v n) * p) i + coeff (poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x))

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (p * poly_of_vec (vec_first v n) + q * poly_of_vec (vec_last v m)) i = (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x))

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
have "... = coeff ?r i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x)) = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
unfolding coeff_add coeff_mult Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x)) = (\<Sum>ia\<le>i. coeff (poly_of_vec (vec_first v n)) ia * coeff p (i - ia)) + (\<Sum>ia\<le>i. coeff (poly_of_vec (vec_last v m)) ia * coeff q (i - ia))
[PROOF STEP]
unfolding coeff_poly_of_vec dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x)) = (\<Sum>ia\<le>i. (if ia < n then vec_first v n $ (n - Suc ia) else (0::'a)) * coeff p (i - ia)) + (\<Sum>ia\<le>i. (if ia < m then vec_last v m $ (m - Suc ia) else (0::'a)) * coeff q (i - ia))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<le>i. (if x < n then vec_first v n $ (n - Suc x) else (0::'a)) * coeff p (i - x)) + (\<Sum>x\<le>i. (if x < m then vec_last v m $ (m - Suc x) else (0::'a)) * coeff q (i - x)) = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i

goal (1 subgoal):
 1. i < m + n \<Longrightarrow> coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i

goal (1 subgoal):
 1. coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff (poly_of_vec ((sylvester_mat_sub m n p q)\<^sup>T *\<^sub>v v)) i = coeff (poly_of_vec (vec_first v n) * p + poly_of_vec (vec_last v m) * q) i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "0.49 \<le> x \<and> x \<le> 4.49 \<Longrightarrow> \<bar> arctan x - 0.91 \<bar> < 0.455"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 49 / 10\<^sup>2 \<le> x \<and> x \<le> 449 / 10\<^sup>2 \<Longrightarrow> \<bar>arctan x - 91 / 10\<^sup>2\<bar> < 455 / 10 ^ 3
[PROOF STEP]
by (approximation 20)


[STATEMENT]
theorem p9: "(p \<or> q) \<and> (\<not>p \<or> q) \<and> (p \<or> \<not>q) \<Longrightarrow> \<not>(\<not>p \<or> \<not>q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<or> q) \<and> (\<not> p \<or> q) \<and> (p \<or> \<not> q) \<Longrightarrow> \<not> (\<not> p \<or> \<not> q)
[PROOF STEP]
by auto2


[STATEMENT]
theorem inverse_function_theorem:
  fixes f::"'a::euclidean_space \<Rightarrow> 'a"
    and f'::"'a \<Rightarrow> ('a \<Rightarrow>\<^sub>L 'a)"
  assumes "open U"
    and derf: "\<And>x. x \<in> U \<Longrightarrow> (f has_derivative (blinfun_apply (f' x))) (at x)"
    and contf:  "continuous_on U f'"
    and "x0 \<in> U"
    and invf: "invf o\<^sub>L f' x0 = id_blinfun"
  obtains U' V g g' where "open U'" "U' \<subseteq> U" "x0 \<in> U'" "open V" "f x0 \<in> V" "homeomorphism U' V f g"
    "\<And>y. y \<in> V \<Longrightarrow> (g has_derivative (g' y)) (at y)"
    "\<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f'(g y)))"
    "\<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f'(g y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have apply1 [simp]: "\<And>i. blinfun_apply invf (blinfun_apply (f' x0) i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. blinfun_apply invf (blinfun_apply (f' x0) i) = i
[PROOF STEP]
by (metis blinfun_apply_blinfun_compose blinfun_apply_id_blinfun invf)
[PROOF STATE]
proof (state)
this:
blinfun_apply invf (blinfun_apply (f' x0) ?i) = ?i

goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have apply2 [simp]: "\<And>i. blinfun_apply (f' x0) (blinfun_apply invf i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. blinfun_apply (f' x0) (blinfun_apply invf i) = i
[PROOF STEP]
by (metis apply1 bij_inv_eq_iff blinfun_bij1 invf)
[PROOF STATE]
proof (state)
this:
blinfun_apply (f' x0) (blinfun_apply invf ?i) = ?i

goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have [simp]: "(range (blinfun_apply invf)) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj (blinfun_apply invf)
[PROOF STEP]
using apply1 surjI
[PROOF STATE]
proof (prove)
using this:
blinfun_apply invf (blinfun_apply (f' x0) ?i) = ?i
(\<And>x. ?g (?f x) = x) \<Longrightarrow> surj ?g

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

goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?f = "invf \<circ> (\<lambda>x. (f \<circ> (+)x0)x - f x0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?f' = "\<lambda>x. invf o\<^sub>L (f' (x + x0))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain U' V g g' where "open U'" and U': "U' \<subseteq> (+)(-x0) ` U" "0 \<in> U'"
    and "open V" "0 \<in> V" and hom: "homeomorphism U' V ?f g"
    and derg: "\<And>y. y \<in> V \<Longrightarrow> (g has_derivative (g' y)) (at y)"
    and g': "\<And>y. y \<in> V \<Longrightarrow> g' y = inv (?f'(g y))"
    and bij: "\<And>y. y \<in> V \<Longrightarrow> bij (?f'(g y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule inverse_function_theorem_scaled [of "(+)(-x0) ` U" ?f "?f'"])
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> open ((+) (- x0) ` U)
 2. \<And>x. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; x \<in> (+) (- x0) ` U\<rbrakk> \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (x + x0))) (at x)
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
 4. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 5. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 6. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 7. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ope: "open ((+) (- x0) ` U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open ((+) (- x0) ` U)
[PROOF STEP]
using \<open>open U\<close> open_translation
[PROOF STATE]
proof (prove)
using this:
open U
open ?S \<Longrightarrow> open ((+) ?a ` ?S)

goal (1 subgoal):
 1. open ((+) (- x0) ` U)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
open ((+) (- x0) ` U)

goal (6 subgoals):
 1. \<And>x. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; x \<in> (+) (- x0) ` U\<rbrakk> \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (x + x0))) (at x)
 2. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 4. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 5. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 6. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "(?f has_derivative blinfun_apply (?f' x)) (at x)"
      if "x \<in> (+) (- x0) ` U" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (x + x0))) (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> (+) (- x0) ` U

goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (x + x0))) (at x)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>xa \<in> U; x = - x0 + xa\<rbrakk> \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (- x0 + xa + x0))) (at (- x0 + xa))
[PROOF STEP]
apply (rule derf derivative_eq_intros | simp add: blinfun_compose.rep_eq)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
?x \<in> (+) (- x0) ` U \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0) has_derivative blinfun_apply (invf o\<^sub>L f' (?x + x0))) (at ?x)

goal (5 subgoals):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
 2. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 4. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 5. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have YY: "(\<lambda>x. f' (x + x0)) \<midarrow>u-x0\<rightarrow> f' u"
      if "f' \<midarrow>u\<rightarrow> f' u" "u \<in> U" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f' (x + x0)) \<midarrow>u - x0\<rightarrow> f' u
[PROOF STEP]
using that LIM_offset [where k = x0]
[PROOF STATE]
proof (prove)
using this:
f' \<midarrow>u\<rightarrow> f' u
u \<in> U
?f \<midarrow>?a\<rightarrow> ?L \<Longrightarrow> (\<lambda>x. ?f (x + x0)) \<midarrow>?a - x0\<rightarrow> ?L

goal (1 subgoal):
 1. (\<lambda>x. f' (x + x0)) \<midarrow>u - x0\<rightarrow> f' u
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>f' \<midarrow>?u\<rightarrow> f' ?u; ?u \<in> U\<rbrakk> \<Longrightarrow> (\<lambda>x. f' (x + x0)) \<midarrow>?u - x0\<rightarrow> f' ?u

goal (5 subgoals):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
 2. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 4. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 5. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>f' \<midarrow>?u\<rightarrow> f' ?u; ?u \<in> U\<rbrakk> \<Longrightarrow> (\<lambda>x. f' (x + x0)) \<midarrow>?u - x0\<rightarrow> f' ?u
[PROOF STEP]
have "continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f' \<midarrow>?u\<rightarrow> f' ?u; ?u \<in> U\<rbrakk> \<Longrightarrow> (\<lambda>x. f' (x + x0)) \<midarrow>?u - x0\<rightarrow> f' ?u

goal (1 subgoal):
 1. continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))
[PROOF STEP]
using contf \<open>open U\<close> Lim_at_imp_Lim_at_within
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f' \<midarrow>?u\<rightarrow> f' ?u; ?u \<in> U\<rbrakk> \<Longrightarrow> (\<lambda>x. f' (x + x0)) \<midarrow>?u - x0\<rightarrow> f' ?u
continuous_on U f'
open U
?f \<midarrow>?x\<rightarrow> ?l \<Longrightarrow> (?f \<longlongrightarrow> ?l) (at ?x within ?S)

goal (1 subgoal):
 1. continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))
[PROOF STEP]
by (fastforce simp: continuous_on_def at_within_open_NO_MATCH ope)
[PROOF STATE]
proof (state)
this:
continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))

goal (5 subgoals):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
 2. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 4. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 5. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))
[PROOF STEP]
show "continuous_on ((+) (- x0) ` U) ?f'"
[PROOF STATE]
proof (prove)
using this:
continuous_on ((+) (- x0) ` U) (\<lambda>x. f' (x + x0))

goal (1 subgoal):
 1. continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))
[PROOF STEP]
by (intro continuous_intros) simp
[PROOF STATE]
proof (state)
this:
continuous_on ((+) (- x0) ` U) (\<lambda>x. invf o\<^sub>L f' (x + x0))

goal (4 subgoals):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (0::'a) \<in> (+) (- x0) ` U
 2. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (0::'a) = (0::'a)
 3. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> invf o\<^sub>L f' ((0::'a) + x0) = id_blinfun
 4. \<And>U' V g g'. \<lbrakk>\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis; open U'; U' \<subseteq> (+) (- x0) ` U; (0::'a) \<in> U'; open V; (0::'a) \<in> V; homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (invf o\<^sub>L f' (g y + x0))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g y + x0)))\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed (auto simp: invf \<open>x0 \<in> U\<close>)
[PROOF STATE]
proof (state)
this:
open U'
U' \<subseteq> (+) (- x0) ` U
(0::'a) \<in> U'
open V
(0::'a) \<in> V
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
?y \<in> V \<Longrightarrow> (g has_derivative g' ?y) (at ?y)
?y \<in> V \<Longrightarrow> g' ?y = inv (blinfun_apply (invf o\<^sub>L f' (g ?y + x0)))
?y \<in> V \<Longrightarrow> bij (blinfun_apply (invf o\<^sub>L f' (g ?y + x0)))

goal (1 subgoal):
 1. (\<And>U' V g g'. \<lbrakk>open U'; U' \<subseteq> U; x0 \<in> U'; open V; f x0 \<in> V; homeomorphism U' V f g; \<And>y. y \<in> V \<Longrightarrow> (g has_derivative g' y) (at y); \<And>y. y \<in> V \<Longrightarrow> g' y = inv (blinfun_apply (f' (g y))); \<And>y. y \<in> V \<Longrightarrow> bij (blinfun_apply (f' (g y)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. open ?U'
 2. ?U' \<subseteq> U
 3. x0 \<in> ?U'
 4. open ?V
 5. f x0 \<in> ?V
 6. homeomorphism ?U' ?V f ?g
 7. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 8. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 9. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
let ?U' = "(+)x0 ` U'"
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. open ?U'
 2. ?U' \<subseteq> U
 3. x0 \<in> ?U'
 4. open ?V
 5. f x0 \<in> ?V
 6. homeomorphism ?U' ?V f ?g
 7. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 8. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 9. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
let ?V = "((+)(f x0) \<circ> f' x0) ` V"
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. open ?U'
 2. ?U' \<subseteq> U
 3. x0 \<in> ?U'
 4. open ?V
 5. f x0 \<in> ?V
 6. homeomorphism ?U' ?V f ?g
 7. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 8. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 9. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
let ?g = "(+)x0 \<circ> g \<circ> invf \<circ> (+)(- f x0)"
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. open ?U'
 2. ?U' \<subseteq> U
 3. x0 \<in> ?U'
 4. open ?V
 5. f x0 \<in> ?V
 6. homeomorphism ?U' ?V f ?g
 7. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 8. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 9. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
let ?g' = "\<lambda>y. inv (blinfun_apply (f' (?g y)))"
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. open ?U'
 2. ?U' \<subseteq> U
 3. x0 \<in> ?U'
 4. open ?V
 5. f x0 \<in> ?V
 6. homeomorphism ?U' ?V f ?g
 7. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 8. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 9. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show oU': "open ?U'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open ((+) x0 ` U')
[PROOF STEP]
by (simp add: \<open>open U'\<close> open_translation)
[PROOF STATE]
proof (state)
this:
open ((+) x0 ` U')

goal (8 subgoals):
 1. (+) x0 ` U' \<subseteq> U
 2. x0 \<in> (+) x0 ` U'
 3. open ?V
 4. f x0 \<in> ?V
 5. homeomorphism ((+) x0 ` U') ?V f ?g
 6. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 7. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 8. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show subU: "?U' \<subseteq> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) x0 ` U' \<subseteq> U
[PROOF STEP]
using ComplI \<open>U' \<subseteq> (+) (- x0) ` U\<close>
[PROOF STATE]
proof (prove)
using this:
(?c \<in> ?A \<Longrightarrow> False) \<Longrightarrow> ?c \<in> - ?A
U' \<subseteq> (+) (- x0) ` U

goal (1 subgoal):
 1. (+) x0 ` U' \<subseteq> U
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(+) x0 ` U' \<subseteq> U

goal (7 subgoals):
 1. x0 \<in> (+) x0 ` U'
 2. open ?V
 3. f x0 \<in> ?V
 4. homeomorphism ((+) x0 ` U') ?V f ?g
 5. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 6. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 7. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show "x0 \<in> ?U'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x0 \<in> (+) x0 ` U'
[PROOF STEP]
by (simp add: \<open>0 \<in> U'\<close>)
[PROOF STATE]
proof (state)
this:
x0 \<in> (+) x0 ` U'

goal (6 subgoals):
 1. open ?V
 2. f x0 \<in> ?V
 3. homeomorphism ((+) x0 ` U') ?V f ?g
 4. \<And>y. y \<in> ?V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 5. \<And>y. y \<in> ?V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 6. \<And>y. y \<in> ?V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show "open ?V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V)
[PROOF STEP]
using blinfun_bij2 [OF invf]
[PROOF STATE]
proof (prove)
using this:
bij (blinfun_apply (f' x0))

goal (1 subgoal):
 1. open (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V)
[PROOF STEP]
by (metis \<open>open V\<close> bij_is_surj blinfun.bounded_linear_right bounded_linear_def image_comp open_surjective_linear_image open_translation)
[PROOF STATE]
proof (state)
this:
open (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V)

goal (5 subgoals):
 1. f x0 \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
 2. homeomorphism ((+) x0 ` U') (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) f ?g
 3. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 4. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 5. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show "f x0 \<in> ?V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x0 \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
[PROOF STEP]
using \<open>0 \<in> V\<close> image_iff
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> V
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. f x0 \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f x0 \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V

goal (4 subgoals):
 1. homeomorphism ((+) x0 ` U') (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) f ?g
 2. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> (?g has_derivative ?g' y) (at y)
 3. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (?g y)))
 4. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> bij (blinfun_apply (f' (?g y)))
[PROOF STEP]
show "homeomorphism ?U' ?V f ?g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism ((+) x0 ` U') (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) f ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. continuous_on ((+) x0 ` U') f
 2. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 3. f ` (+) x0 ` U' \<subseteq> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
 4. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
 5. \<And>x. x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
 6. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
show "continuous_on ?U' f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ((+) x0 ` U') f
[PROOF STEP]
by (meson subU continuous_on_eq_continuous_at derf has_derivative_continuous oU' subsetD)
[PROOF STATE]
proof (state)
this:
continuous_on ((+) x0 ` U') f

goal (5 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. f ` (+) x0 ` U' \<subseteq> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
 3. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
 4. \<And>x. x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
 5. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
have "?f ` U' \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) ` U' \<subseteq> V
[PROOF STEP]
using hom homeomorphism_image1
[PROOF STATE]
proof (prove)
using this:
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
homeomorphism ?S ?T ?f ?g \<Longrightarrow> ?f ` ?S = ?T

goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) ` U' \<subseteq> V
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) ` U' \<subseteq> V

goal (5 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. f ` (+) x0 ` U' \<subseteq> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
 3. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
 4. \<And>x. x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
 5. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) ` U' \<subseteq> V
[PROOF STEP]
show "f ` ?U' \<subseteq> ?V"
[PROOF STATE]
proof (prove)
using this:
(blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) ` U' \<subseteq> V

goal (1 subgoal):
 1. f ` (+) x0 ` U' \<subseteq> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
[PROOF STEP]
unfolding image_subset_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>U'. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) x \<in> V

goal (1 subgoal):
 1. \<forall>x\<in>(+) x0 ` U'. f x \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
[PROOF STEP]
by (clarsimp simp: image_def) (metis apply2 add.commute diff_add_cancel)
[PROOF STATE]
proof (state)
this:
f ` (+) x0 ` U' \<subseteq> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V

goal (4 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
 3. \<And>x. x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
 4. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
show "?g ` ?V \<subseteq> ?U'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
[PROOF STEP]
using hom invf
[PROOF STATE]
proof (prove)
using this:
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
invf o\<^sub>L f' x0 = id_blinfun

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'
[PROOF STEP]
by (auto simp: image_def homeomorphism_def)
[PROOF STATE]
proof (state)
this:
((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ` ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<subseteq> (+) x0 ` U'

goal (3 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. \<And>x. x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
 3. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
show "?g (f x) = x"
        if "x \<in> ?U'" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
[PROOF STEP]
using that hom homeomorphism_apply1
[PROOF STATE]
proof (prove)
using this:
x \<in> (+) x0 ` U'
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
\<lbrakk>homeomorphism ?S ?T ?f ?g; ?x \<in> ?S\<rbrakk> \<Longrightarrow> ?g (?f ?x) = ?x

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f x) = x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?x \<in> (+) x0 ` U' \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) (f ?x) = ?x

goal (2 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
have "continuous_on V g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on V g
[PROOF STEP]
using hom homeomorphism_def
[PROOF STATE]
proof (prove)
using this:
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
homeomorphism ?s ?t ?f ?g = ((\<forall>x\<in>?s. ?g (?f x) = x) \<and> ?f ` ?s = ?t \<and> continuous_on ?s ?f \<and> (\<forall>y\<in>?t. ?f (?g y) = y) \<and> ?g ` ?t = ?s \<and> continuous_on ?t ?g)

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

goal (2 subgoals):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
 2. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on V g
[PROOF STEP]
show "continuous_on ?V ?g"
[PROOF STATE]
proof (prove)
using this:
continuous_on V g

goal (1 subgoal):
 1. continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))
[PROOF STEP]
by (intro continuous_intros) (auto elim!: continuous_on_subset)
[PROOF STATE]
proof (state)
this:
continuous_on (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))

goal (1 subgoal):
 1. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
have fg: "?f (g x) = x" if "x \<in> V" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (g x) = x
[PROOF STEP]
using hom homeomorphism_apply2 that
[PROOF STATE]
proof (prove)
using this:
homeomorphism U' V (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) g
\<lbrakk>homeomorphism ?S ?T ?f ?g; ?x \<in> ?T\<rbrakk> \<Longrightarrow> ?f (?g ?x) = ?x
x \<in> V

goal (1 subgoal):
 1. (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (g x) = x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> V \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (g ?x) = ?x

goal (1 subgoal):
 1. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
show "f (?g y) = y"
        if "y \<in> ?V" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
using that fg
[PROOF STATE]
proof (prove)
using this:
y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
?x \<in> V \<Longrightarrow> (blinfun_apply invf \<circ> (\<lambda>x. (f \<circ> (+) x0) x - f x0)) (g ?x) = ?x

goal (1 subgoal):
 1. f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y) = y
[PROOF STEP]
by (simp add: image_iff) (metis apply2 add.commute diff_add_cancel)
[PROOF STATE]
proof (state)
this:
?y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> f (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ?y) = ?y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
homeomorphism ((+) x0 ` U') (((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V) f ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0))

goal (3 subgoals):
 1. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative ?g' y) (at y)
 2. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> ?g' y = inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
 3. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
show "(?g has_derivative ?g' y) (at y)" "bij (blinfun_apply (f' (?g y)))"
      if "y \<in> ?V" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y) &&& bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
 2. bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
have 1: "bij (blinfun_apply invf)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (blinfun_apply invf)
[PROOF STEP]
using blinfun_bij1 invf
[PROOF STATE]
proof (prove)
using this:
?f o\<^sub>L ?g = id_blinfun \<Longrightarrow> bij (blinfun_apply ?f)
invf o\<^sub>L f' x0 = id_blinfun

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

goal (2 subgoals):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
 2. bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij (blinfun_apply invf)
[PROOF STEP]
have 2: "bij (blinfun_apply (f' (x0 + g x)))" if "x \<in> V" for x
[PROOF STATE]
proof (prove)
using this:
bij (blinfun_apply invf)

goal (1 subgoal):
 1. bij (blinfun_apply (f' (x0 + g x)))
[PROOF STEP]
by (metis add.commute bij bij_betw_comp_iff2 blinfun_compose.rep_eq that top_greatest)
[PROOF STATE]
proof (state)
this:
?x \<in> V \<Longrightarrow> bij (blinfun_apply (f' (x0 + g ?x)))

goal (2 subgoals):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
 2. bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> V \<Longrightarrow> bij (blinfun_apply (f' (x0 + g ?x)))
[PROOF STEP]
show "bij (blinfun_apply (f' (?g y)))"
[PROOF STATE]
proof (prove)
using this:
?x \<in> V \<Longrightarrow> bij (blinfun_apply (f' (x0 + g ?x)))

goal (1 subgoal):
 1. bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?x \<in> V \<Longrightarrow> bij (blinfun_apply (f' (x0 + g ?x)))
y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V

goal (1 subgoal):
 1. bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
[PROOF STEP]
have "g' x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g x)))"
        if "x \<in> V" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g' x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g x)))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> V

goal (1 subgoal):
 1. g' x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g x)))
[PROOF STEP]
by (simp add: g' o_inv_distrib blinfun_compose.rep_eq 1 2 add.commute bij_is_inj flip: o_assoc)
[PROOF STATE]
proof (state)
this:
?x \<in> V \<Longrightarrow> g' ?x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g ?x)))

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> V \<Longrightarrow> g' ?x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g ?x)))
[PROOF STEP]
show "(?g has_derivative ?g' y) (at y)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> V \<Longrightarrow> g' ?x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g ?x)))

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
[PROOF STEP]
using that invf
[PROOF STATE]
proof (prove)
using this:
?x \<in> V \<Longrightarrow> g' ?x \<circ> blinfun_apply invf = inv (blinfun_apply (f' (x0 + g ?x)))
y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V
invf o\<^sub>L f' x0 = id_blinfun

goal (1 subgoal):
 1. ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)
[PROOF STEP]
by clarsimp (rule derg derivative_eq_intros | simp flip: id_def)+
[PROOF STATE]
proof (state)
this:
((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))) (at y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> ((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0) has_derivative inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ?y)))) (at ?y)
?y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> bij (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) ?y)))

goal (1 subgoal):
 1. \<And>y. y \<in> ((+) (f x0) \<circ> blinfun_apply (f' x0)) ` V \<Longrightarrow> inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y))) = inv (blinfun_apply (f' (((+) x0 \<circ> g \<circ> blinfun_apply invf \<circ> (+) (- f x0)) y)))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem meet_related [elim?]: "x \<sqsubseteq> y \<Longrightarrow> x \<sqinter> y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<sqinter> y = x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> x
 2. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> y
 3. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
assume "x \<sqsubseteq> y"
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> y

goal (3 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> x
 2. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> y
 3. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "x \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> x

goal (2 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> y
 2. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "x \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> y
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
assume "z \<sqsubseteq> x" and "z \<sqsubseteq> y"
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> x
z \<sqsubseteq> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> y; z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "z \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<sqsubseteq> x
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bit_cut_integer_code [code]:
  "bit_cut_integer k = (if k = 0 then (0, False)
     else let (r, s) = Code_Numeral.divmod_abs k 2
       in (if k > 0 then r else - r - s, s = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_cut_integer k = (if k = 0 then (0, False) else let (r, s) = divmod_abs k 2 in (if 0 < k then r else - r - s, s = 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit_cut_integer k = (if k = 0 then (0, False) else let (r, s) = divmod_abs k 2 in (if 0 < k then r else - r - s, s = 1))
[PROOF STEP]
have "bit_cut_integer k = (let (r, s) = divmod_integer k 2 in (r, s = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_cut_integer k = (let (r, s) = divmod_integer k 2 in (r, s = 1))
[PROOF STEP]
by (simp add: divmod_integer_def bit_cut_integer_def odd_iff_mod_2_eq_one)
[PROOF STATE]
proof (state)
this:
bit_cut_integer k = (let (r, s) = divmod_integer k 2 in (r, s = 1))

goal (1 subgoal):
 1. bit_cut_integer k = (if k = 0 then (0, False) else let (r, s) = divmod_abs k 2 in (if 0 < k then r else - r - s, s = 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bit_cut_integer k = (let (r, s) = divmod_integer k 2 in (r, s = 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bit_cut_integer k = (let (r, s) = divmod_integer k 2 in (r, s = 1))

goal (1 subgoal):
 1. bit_cut_integer k = (if k = 0 then (0, False) else let (r, s) = divmod_abs k 2 in (if 0 < k then r else - r - s, s = 1))
[PROOF STEP]
by (simp add: divmod_integer_code) (auto simp add: split_def)
[PROOF STATE]
proof (state)
this:
bit_cut_integer k = (if k = 0 then (0, False) else let (r, s) = divmod_abs k 2 in (if 0 < k then r else - r - s, s = 1))

goal:
No subgoals!
[PROOF STEP]
qed