[STATEMENT]
lemma det_row_add:
  assumes abc: "a k \<in> carrier_vec n" "b k \<in> carrier_vec n" "c \<in> {0..<n} \<rightarrow> carrier_vec n"
    and k: "k < n"
  shows "det(mat\<^sub>r n n (\<lambda> i. if i = k then a i + b i else c i)) =
    det(mat\<^sub>r n n (\<lambda> i. if i = k then a i else c i)) +
    det(mat\<^sub>r n n (\<lambda> i. if i = k then b i else c i))"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
let ?n = "{0..<n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
let ?m = "\<lambda> a b p i. mat\<^sub>r n n (\<lambda>i. if i = k then a i else b i) $$ (i, p i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
let ?c = "\<lambda> p i. mat\<^sub>r n n c $$ (i, p i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
let ?ab = "\<lambda> i. a i + b i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
note intros = add_carrier_vec[of _ n]
[PROOF STATE]
proof (state)
this:
\<lbrakk>?v\<^sub>1 \<in> carrier_vec n; ?v\<^sub>2 \<in> carrier_vec n\<rbrakk> \<Longrightarrow> ?v\<^sub>1 + ?v\<^sub>2 \<in> carrier_vec n

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
have "?rhs = (\<Sum>p\<in>{p. p permutes ?n}.
    signof p * (\<Prod>i\<in>?n. ?m a c p i)) + (\<Sum>p\<in>{p. p permutes ?n}. signof p * (\<Prod>i\<in>?n. ?m b c p i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) = dim_col (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) then \<Sum>p | p permutes {0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i))}. of_int (sign p) * (\<Prod>i = 0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)). mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) else (0::'a)) + (if dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = dim_col (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) then \<Sum>p | p permutes {0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))}. of_int (sign p) * (\<Prod>i = 0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)). mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) else (0::'a)) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
have "\<dots> = (\<Sum>p\<in>{p. p permutes ?n}. signof p * (\<Prod>i\<in>?n. ?m a c p i) +  signof p * (\<Prod>i\<in>?n. ?m b c p i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))
[PROOF STEP]
by (rule sum.distrib[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))) + (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
have "\<dots> = (\<Sum>p\<in>{p. p permutes ?n}. signof p * (\<Prod>i\<in>?n. ?m ?ab c p i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)))
[PROOF STEP]
proof (rule sum.cong, force)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {p. p permutes {0..<n}} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, x i)) + of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, x i)) = of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, x i))
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {p. p permutes {0..<n}} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, x i)) + of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, x i)) = of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, x i))
[PROOF STEP]
assume "p \<in> {p. p permutes ?n}"
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes {0..<n}}

goal (1 subgoal):
 1. \<And>x. x \<in> {p. p permutes {0..<n}} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, x i)) + of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, x i)) = of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, x i))
[PROOF STEP]
hence p: "p permutes ?n"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. p permutes {0..<n}}

goal (1 subgoal):
 1. p permutes {0..<n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p permutes {0..<n}

goal (1 subgoal):
 1. \<And>x. x \<in> {p. p permutes {0..<n}} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, x i)) + of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, x i)) = of_int (sign x) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, x i))
[PROOF STEP]
show "signof p * (\<Prod>i\<in>?n. ?m a c p i) + signof p * (\<Prod>i\<in>?n. ?m b c p i) =
      signof p * (\<Prod>i\<in>?n. ?m ?ab c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
unfolding distrib_left[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign p) * ((\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
proof (rule arg_cong[of _ _ "\<lambda> a. signof p * a"])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
from k
[PROOF STATE]
proof (chain)
picking this:
k < n
[PROOF STEP]
have f: "finite ?n" and k': "k \<in> ?n"
[PROOF STATE]
proof (prove)
using this:
k < n

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

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
let ?nk = "?n - {k}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
note split = prod.remove[OF f k']
[PROOF STATE]
proof (state)
this:
prod ?g {0..<n} = ?g k * prod ?g ({0..<n} - {k})

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have id1: "(\<Prod>i\<in>?n. ?m a c p i) = ?m a c p k * (\<Prod>i\<in>?nk. ?m a c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))
[PROOF STEP]
by (rule split)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have id2: "(\<Prod>i\<in>?n. ?m b c p i) = ?m b c p k * (\<Prod>i\<in>?nk. ?m b c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))
[PROOF STEP]
by (rule split)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have id3: "(\<Prod>i\<in>?n. ?m ?ab c p i) = ?m ?ab c p k * (\<Prod>i\<in>?nk. ?m ?ab c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
by (rule split)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have id: "\<And> a. (\<Prod>i\<in>?nk. ?m a c p i) = (\<Prod>i\<in>?nk. ?c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) = (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n c $$ (i, p i))
[PROOF STEP]
by (rule prod.cong, insert abc k p, auto intro!: intros)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then ?a1 i else c i) $$ (i, p i)) = (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n c $$ (i, p i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have ab: "?ab k \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k + b k \<in> carrier_vec n
[PROOF STEP]
using abc
[PROOF STATE]
proof (prove)
using this:
a k \<in> carrier_vec n
b k \<in> carrier_vec n
c \<in> {0..<n} \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. a k + b k \<in> carrier_vec n
[PROOF STEP]
by (auto intro: intros)
[PROOF STATE]
proof (state)
this:
a k + b k \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
a k + b k \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
assume "f k \<in> (carrier_vec n :: 'a vec set)"
[PROOF STATE]
proof (state)
this:
f k \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
hence "mat\<^sub>r n n (\<lambda>i. if i = k then f i else c i) $$ (k, p k) = f k $ p k"
[PROOF STATE]
proof (prove)
using this:
f k \<in> carrier_vec n

goal (1 subgoal):
 1. mat\<^sub>r n n (\<lambda>i. if i = k then f i else c i) $$ (k, p k) = f k $ p k
[PROOF STEP]
by (insert p k abc, auto)
[PROOF STATE]
proof (state)
this:
mat\<^sub>r n n (\<lambda>i. if i = k then f i else c i) $$ (k, p k) = f k $ p k

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?f3 k \<in> carrier_vec n \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. if i = k then ?f3 i else c i) $$ (k, p k) = ?f3 k $ p k

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
note first = this
[PROOF STATE]
proof (state)
this:
?f3 k \<in> carrier_vec n \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. if i = k then ?f3 i else c i) $$ (k, p k) = ?f3 k $ p k

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
note id' = id1 id2 id3
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i))
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)) = mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (k, p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
have dist: "(a k + b k) $ p k = a k $ p k + b k $ p k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a k + b k) $ p k = a k $ p k + b k $ p k
[PROOF STEP]
by (rule index_add_vec(1), insert p k abc, force)
[PROOF STATE]
proof (state)
this:
(a k + b k) $ p k = a k $ p k + b k $ p k

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
show "(\<Prod>i\<in>?n. ?m a c p i) + (\<Prod>i\<in>?n. ?m b c p i) = (\<Prod>i\<in>?n. ?m ?ab c p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))
[PROOF STEP]
unfolding id' id first[of a, OF abc(1)] first[of b, OF abc(2)] first[of ?ab, OF ab] dist
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k $ p k * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n c $$ (i, p i)) + b k $ p k * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n c $$ (i, p i)) = (a k $ p k + b k $ p k) * (\<Prod>i\<in>{0..<n} - {k}. mat\<^sub>r n n c $$ (i, p i))
[PROOF STEP]
by (rule distrib_right[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i)) = of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i) $$ (i, p i)) + of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i) $$ (i, p i))) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
have "\<dots> = ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i))
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))) = (if dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = dim_col (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) then \<Sum>p | p permutes {0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i))}. of_int (sign p) * (\<Prod>i = 0..<dim_row (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)). mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i)) else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i) $$ (i, p i))) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i = k then a i + b i else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = k then a i else c i)) + det (mat\<^sub>r n n (\<lambda>i. if i = k then b i else c i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hypnat_add_one_gt_one: "\<And>N::hypnat. 0 < N \<Longrightarrow> 1 < N + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. 0 < N \<Longrightarrow> 1 < N + 1
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma if_then_0_else_1:
  "((if P then 0 else 1) = (0 :: machine_word)) = (P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if P then 0 else 1) = 0) = P
[PROOF STEP]
by simp


[STATEMENT]
lemma tank_arith:
  assumes "0 \<le> (\<tau>::real)" and "0 < c\<^sub>o" and "c\<^sub>o < c\<^sub>i"
  shows "\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - ((hmin - y) / c\<^sub>o) \<Longrightarrow>  hmin \<le> y - c\<^sub>o * \<tau>"
    and "\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> (hmax - y) / (c\<^sub>i - c\<^sub>o) \<Longrightarrow>  (c\<^sub>i - c\<^sub>o) * \<tau> + y \<le> hmax"
    and "hmin \<le> y \<Longrightarrow> hmin \<le> (c\<^sub>i - c\<^sub>o) \<cdot> \<tau> + y"
    and "y \<le> hmax \<Longrightarrow> y - c\<^sub>o \<cdot> \<tau> \<le> hmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - ((hmin - y) / c\<^sub>o) \<Longrightarrow> hmin \<le> y - c\<^sub>o \<cdot> \<tau>) &&& (\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> (hmax - y) / (c\<^sub>i - c\<^sub>o) \<Longrightarrow> (c\<^sub>i - c\<^sub>o) \<cdot> \<tau> + y \<le> hmax)) &&& (hmin \<le> y \<Longrightarrow> hmin \<le> (c\<^sub>i - c\<^sub>o) \<cdot> \<tau> + y) &&& (y \<le> hmax \<Longrightarrow> y - c\<^sub>o \<cdot> \<tau> \<le> hmax)
[PROOF STEP]
apply(simp_all add: field_simps le_divide_eq assms)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. hmin \<le> y \<Longrightarrow> hmin + \<tau> \<cdot> c\<^sub>o \<le> y + \<tau> \<cdot> c\<^sub>i
 2. y \<le> hmax \<Longrightarrow> y \<le> hmax + \<tau> \<cdot> c\<^sub>o
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau>
0 < c\<^sub>o
c\<^sub>o < c\<^sub>i

goal (2 subgoals):
 1. hmin \<le> y \<Longrightarrow> hmin + \<tau> \<cdot> c\<^sub>o \<le> y + \<tau> \<cdot> c\<^sub>i
 2. y \<le> hmax \<Longrightarrow> y \<le> hmax + \<tau> \<cdot> c\<^sub>o
[PROOF STEP]
apply (meson add_mono less_eq_real_def mult_left_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> hmax \<Longrightarrow> y \<le> hmax + \<tau> \<cdot> c\<^sub>o
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau>
0 < c\<^sub>o
c\<^sub>o < c\<^sub>i

goal (1 subgoal):
 1. y \<le> hmax \<Longrightarrow> y \<le> hmax + \<tau> \<cdot> c\<^sub>o
[PROOF STEP]
by (meson add_increasing2 less_eq_real_def mult_nonneg_nonneg)


[STATEMENT]
lemma (in Module) unique_expression3:
   "\<lbrakk>H \<subseteq> carrier M; f \<in> {k. k \<le> (Suc n)} \<rightarrow> H;
     s \<in> {k. k \<le> (Suc n)} \<rightarrow> carrier R; l \<le> (Suc n);
    (f l) \<notin> f ` ({k. k \<le> (Suc n)} - {l})\<rbrakk> \<Longrightarrow>
   \<exists>g m t. g \<in> {k. k \<le> (m::nat)} \<rightarrow> H \<and>
        inj_on g {k. k \<le> m} \<and>
        t \<in> {k. k \<le> m} \<rightarrow> carrier R \<and>
        l_comb R M (Suc n) s f = l_comb R M m t g \<and> t m = s l \<and> g m = f l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier M; f \<in> {k. k \<le> Suc n} \<rightarrow> H; s \<in> {k. k \<le> Suc n} \<rightarrow> carrier R; l \<le> Suc n; f l \<notin> f ` ({k. k \<le> Suc n} - {l})\<rbrakk> \<Longrightarrow> \<exists>g m t. g \<in> {k. k \<le> m} \<rightarrow> H \<and> inj_on g {k. k \<le> m} \<and> t \<in> {k. k \<le> m} \<rightarrow> carrier R \<and> l_comb R M (Suc n) s f = l_comb R M m t g \<and> t m = s l \<and> g m = f l
[PROOF STEP]
apply (case_tac "l = Suc n", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>H \<subseteq> carrier M; f \<in> {k. k \<le> Suc n} \<rightarrow> H; s \<in> {k. k \<le> Suc n} \<rightarrow> carrier R; f (Suc n) \<notin> f ` ({k. k \<le> Suc n} - {Suc n}); l = Suc n\<rbrakk> \<Longrightarrow> \<exists>g m. g \<in> {k. k \<le> m} \<rightarrow> H \<and> inj_on g {k. k \<le> m} \<and> (\<exists>t. t \<in> {k. k \<le> m} \<rightarrow> carrier R \<and> l_comb R M (Suc n) s f = l_comb R M m t g \<and> t m = s (Suc n) \<and> g m = f (Suc n))
 2. \<lbrakk>H \<subseteq> carrier M; f \<in> {k. k \<le> Suc n} \<rightarrow> H; s \<in> {k. k \<le> Suc n} \<rightarrow> carrier R; l \<le> Suc n; f l \<notin> f ` ({k. k \<le> Suc n} - {l}); l \<noteq> Suc n\<rbrakk> \<Longrightarrow> \<exists>g m t. g \<in> {k. k \<le> m} \<rightarrow> H \<and> inj_on g {k. k \<le> m} \<and> t \<in> {k. k \<le> m} \<rightarrow> carrier R \<and> l_comb R M (Suc n) s f = l_comb R M m t g \<and> t m = s l \<and> g m = f l
[PROOF STEP]
apply (cut_tac unique_expression3_1[of H f n s], blast,
        assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier M; f \<in> {k. k \<le> Suc n} \<rightarrow> H; s \<in> {k. k \<le> Suc n} \<rightarrow> carrier R; l \<le> Suc n; f l \<notin> f ` ({k. k \<le> Suc n} - {l}); l \<noteq> Suc n\<rbrakk> \<Longrightarrow> \<exists>g m t. g \<in> {k. k \<le> m} \<rightarrow> H \<and> inj_on g {k. k \<le> m} \<and> t \<in> {k. k \<le> m} \<rightarrow> carrier R \<and> l_comb R M (Suc n) s f = l_comb R M m t g \<and> t m = s l \<and> g m = f l
[PROOF STEP]
apply (rule unique_expression3_2[of H f n s l], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_poincare_line_conjugate_circline [simp]:
  assumes "is_poincare_line H"
  shows "is_poincare_line (conjugate_circline H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_poincare_line (conjugate_circline H)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H

goal (1 subgoal):
 1. is_poincare_line (conjugate_circline H)
[PROOF STEP]
by (transfer, transfer, auto simp add: mat_cnj_def hermitean_def mat_adj_def)


[STATEMENT]
lemma real_of_inj: "(real_of x = real_of y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of x = real_of y) = (x = y)
[PROOF STEP]
by (transfer, simp)


[STATEMENT]
lemma acyclic_square:
  assumes "acyclic (x - 1)"
    shows "x * x \<sqinter> 1 = x \<sqinter> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * x \<sqinter> (1::'a) = x \<sqinter> (1::'a)
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "1 \<sqinter> x * x = 1 \<sqinter> ((x - 1) * x \<squnion> (x \<sqinter> 1) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> x * x = (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x)
[PROOF STEP]
by (metis maddux_3_11_pp regular_one_closed semiring.distrib_right)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> x * x = (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> x * x = (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... \<le> 1 \<sqinter> ((x - 1) * x \<squnion> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x) \<le> (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x)
[PROOF STEP]
by (metis inf.cobounded2 mult_1_left mult_left_isotone inf.sup_right_isotone semiring.add_left_mono)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x) \<le> (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> (x \<sqinter> (1::'a)) * x) \<le> (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... = 1 \<sqinter> ((x - 1) * (x - 1) \<squnion> (x - 1) * (x \<sqinter> 1) \<squnion> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x) = (1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x)
[PROOF STEP]
by (metis maddux_3_11_pp mult_left_dist_sup regular_one_closed)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x) = (1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * x \<squnion> x) = (1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x)

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... \<le> (1 \<sqinter> (x - 1) * (x - 1)) \<squnion> (x - 1) * (x \<sqinter> 1) \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x) \<le> (1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x
[PROOF STEP]
by (metis inf_le2 inf_sup_distrib1 semiring.add_left_mono sup_monoid.add_assoc)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x) \<le> (1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> ((x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x) \<le> (1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... \<le> (1 \<sqinter> (x - 1)\<^sup>+) \<squnion> (x - 1) * (x \<sqinter> 1) \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x \<le> (1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x
[PROOF STEP]
by (metis comp_isotone inf.eq_refl inf.sup_right_isotone star.circ_increasing sup_monoid.add_commute sup_right_isotone)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x \<le> (1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> (x - (1::'a)) * (x - (1::'a)) \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x \<le> (1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... = (x - 1) * (x \<sqinter> 1) \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x = (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x
[PROOF STEP]
by (metis assms inf.le_iff_sup inf.sup_monoid.add_commute inf_import_p inf_p regular_one_closed sup_inf_absorb sup_monoid.add_commute)
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x = (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<sqinter> (x - (1::'a))\<^sup>+ \<squnion> (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x = (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
have "... = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x = x
[PROOF STEP]
by (metis comp_isotone inf.cobounded1 inf_le2 mult_1_right sup.absorb2)
[PROOF STATE]
proof (state)
this:
(x - (1::'a)) * (x \<sqinter> (1::'a)) \<squnion> x = x

goal (2 subgoals):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
 2. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) \<sqinter> x * x \<le> x
[PROOF STEP]
show "x * x \<sqinter> 1 \<le> x \<sqinter> 1"
[PROOF STATE]
proof (prove)
using this:
(1::'a) \<sqinter> x * x \<le> x

goal (1 subgoal):
 1. x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)
[PROOF STEP]
by (simp add: inf.sup_monoid.add_commute)
[PROOF STATE]
proof (state)
this:
x * x \<sqinter> (1::'a) \<le> x \<sqinter> (1::'a)

goal (1 subgoal):
 1. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
show "x \<sqinter> 1 \<le> x * x \<sqinter> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)
[PROOF STEP]
by (metis coreflexive_idempotent inf_le1 inf_le2 le_infI mult_isotone)
[PROOF STATE]
proof (state)
this:
x \<sqinter> (1::'a) \<le> x * x \<sqinter> (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quot_Var: "\<guillemotleft>Var x\<guillemotright> = SUCC (ORD_OF (nat_of_name x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>Var x\<guillemotright> = SUCC (ORD_OF (nat_of_name x))
[PROOF STEP]
by (simp add: quot_tm_def)


[STATEMENT]
lemma (in is_functor) op_cf_obj_comma_is_iso_functor:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
[PROOF STEP]
have cf_const: "cf_const (cat_1 0 0) \<BB> b : cat_1 0 0 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: V_cs_intros cat_cs_intros)
[PROOF STATE]
proof (state)
this:
dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
note cat_obj_cf_comma_def =
    is_functor.cat_obj_cf_comma_def[
      OF is_functor_op, unfolded cat_op_simps
      ]
[PROOF STATE]
proof (state)
this:
?b \<down>\<^sub>C\<^sub>F (op_cf \<FF>) = (dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) (op_cat \<BB>) ?b (\<BB>\<lparr>CId\<rparr>\<lparr>?b\<rparr>)) \<^sub>C\<^sub>F\<down>\<^sub>C\<^sub>F (op_cf \<FF>)

goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
by
      (
        rule op_cf_comma_is_iso_functor
          [
            OF is_functor_axioms cf_const,
            folded cat_cf_obj_comma_def op_cf_obj_comma_def,
            unfolded cat_op_simps,
            folded cat_obj_cf_comma_def
          ]
      )
[PROOF STATE]
proof (state)
this:
op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_iarray_transpose[code_unfold]:
  shows "matrix_to_iarray (transpose A) = transpose_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Finite_Cartesian_Product.transpose A) = transpose_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding matrix_to_iarray_def transpose_def transpose_iarray_def
    o_def tabulate2_def nrows_iarray_def ncols_iarray_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. (\<chi>i j. A $ j $ i) $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('b)) [0..<CARD('c)]) = IArray.of_fun (\<lambda>i. IArray.of_fun (\<lambda>b. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('c)) [0..<CARD('b)]) !! b !! i) (IArray.length (IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('c)) [0..<CARD('b)])))) (IArray.length (IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('c)) [0..<CARD('b)]) !! 0))
[PROOF STEP]
by auto


[STATEMENT]
lemma taq_proots_itv_code[code]:
  "TaQ_itv_rats a b p q = (if a\<ge>b then
      0
    else if poly p a \<noteq> 0 \<and> poly p b \<noteq>0 then
      (let
      ip = clear_de p;
      iq = clear_de q
      in ri_changes_itv_spmods a b ip (pderiv ip * iq))
    else
       Code.abort (STR ''Roots at border yet to be supported'')
                              (\<lambda>_. TaQ_itv_rats a b p q)
    )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
proof (cases "a\<ge>b \<or> poly p a = 0 \<or> poly p b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> poly p a = 0 \<or> poly p b = 0

goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> poly p a = 0 \<or> poly p b = 0

goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have ?thesis if "a\<ge>b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "{x. poly (map_poly of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b}
            = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}
[PROOF STEP]
using that rat_int.r2.hom_less_eq
[PROOF STATE]
proof (prove)
using this:
b \<le> a
(?x \<le> ?y) = (real_of_rat ?x \<le> real_of_rat ?y)

goal (1 subgoal):
 1. {x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}
[PROOF STEP]
have "TaQ_itv_rats a b p q  = taq {} (map_poly real_of_rat q)"
[PROOF STATE]
proof (prove)
using this:
{x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = taq {} (map_poly real_of_rat q)
[PROOF STEP]
unfolding TaQ_itv_rats_def
[PROOF STATE]
proof (prove)
using this:
{x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} = {}

goal (1 subgoal):
 1. taq {x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} (map_poly real_of_rat q) = taq {} (map_poly real_of_rat q)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = taq {} (map_poly real_of_rat q)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = taq {} (map_poly real_of_rat q)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taq {} (map_poly real_of_rat q) = 0
[PROOF STEP]
unfolding taq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{}. sign (poly (map_poly real_of_rat q) x)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
taq {} (map_poly real_of_rat q) = 0

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
TaQ_itv_rats a b p q = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = 0

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = 0
b \<le> a

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<le> a \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<le> a \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have ?thesis if "\<not> a\<ge>b" "poly p a = 0 \<or> poly p b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<not> b \<le> a
poly p a = 0 \<or> poly p b = 0

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> b \<le> a; poly p a = 0 \<or> poly p b = 0\<rbrakk> \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal (2 subgoals):
 1. b \<le> a \<or> poly p a = 0 \<or> poly p b = 0 \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
 2. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<le> a \<or> poly p a = 0 \<or> poly p b = 0
b \<le> a \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
\<lbrakk>\<not> b \<le> a; poly p a = 0 \<or> poly p b = 0\<rbrakk> \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<le> a \<or> poly p a = 0 \<or> poly p b = 0
b \<le> a \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
\<lbrakk>\<not> b \<le> a; poly p a = 0 \<or> poly p b = 0\<rbrakk> \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
define ip iq where "ip = clear_de p" and "iq = clear_de q"
[PROOF STATE]
proof (state)
this:
ip = clear_de p
iq = clear_de q

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
define dp dq where "dp = rat_of_int (de_lcm p)" and "dq = rat_of_int (de_lcm q)"
[PROOF STATE]
proof (state)
this:
dp = rat_of_int (de_lcm p)
dq = rat_of_int (de_lcm q)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
define aa bb where "aa = real_of_rat a" and "bb = real_of_rat b"
[PROOF STATE]
proof (state)
this:
aa = real_of_rat a
bb = real_of_rat b

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "dp > 0" "dq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < dp &&& 0 < dq
[PROOF STEP]
unfolding dp_def dq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < rat_of_int (de_lcm p) &&& 0 < rat_of_int (de_lcm q)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < dp
0 < dq

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have ip:"of_int_poly ip = smult dp p" and iq:"of_int_poly iq = smult dq q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly ip = smult dp p &&& of_int_poly iq = smult dq q
[PROOF STEP]
using clear_de
[PROOF STATE]
proof (prove)
using this:
of_int_poly (clear_de ?p) = smult (rat_of_int (de_lcm ?p)) ?p

goal (1 subgoal):
 1. of_int_poly ip = smult dp p &&& of_int_poly iq = smult dq q
[PROOF STEP]
unfolding ip_def iq_def dp_def dq_def
[PROOF STATE]
proof (prove)
using this:
of_int_poly (clear_de ?p) = smult (rat_of_int (de_lcm ?p)) ?p

goal (1 subgoal):
 1. of_int_poly (clear_de p) = smult (rat_of_int (de_lcm p)) p &&& of_int_poly (clear_de q) = smult (rat_of_int (de_lcm q)) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_poly ip = smult dp p
of_int_poly iq = smult dq q

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "TaQ_itv_rats a b p q = taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0
        \<and> aa < x \<and> x < bb}
        (map_poly real_of_rat (of_int_poly iq))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TaQ_itv_rats a b p q = taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq))
[PROOF STEP]
unfolding TaQ_itv_rats_def ip iq aa_def bb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taq {x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} (map_poly real_of_rat q) = taq {x. poly (map_poly real_of_rat (smult dp p)) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} (map_poly real_of_rat (smult dq q))
[PROOF STEP]
using \<open>dp > 0\<close> \<open>dq >0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < dp
0 < dq

goal (1 subgoal):
 1. taq {x. poly (map_poly real_of_rat p) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} (map_poly real_of_rat q) = taq {x. poly (map_poly real_of_rat (smult dp p)) x = 0 \<and> real_of_rat a < x \<and> x < real_of_rat b} (map_poly real_of_rat (smult dq q))
[PROOF STEP]
by (simp add:of_rat_hom.map_poly_hom_smult taq_smult_pos)
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq))

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq))

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "... = taq {x. poly (of_int_poly ip) x = (0::real)
        \<and> aa < x \<and> x < bb} (of_int_poly iq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq)) = taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq)
[PROOF STEP]
by (simp add:map_poly_map_poly comp_def)
[PROOF STATE]
proof (state)
this:
taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq)) = taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
taq {x. poly (map_poly real_of_rat (of_int_poly ip)) x = 0 \<and> aa < x \<and> x < bb} (map_poly real_of_rat (of_int_poly iq)) = taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "... = changes_itv_smods aa bb (of_int_poly ip)
      (pderiv (of_int_poly ip) * of_int_poly iq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)
[PROOF STEP]
have "aa < bb" "poly (map_poly of_int ip) aa \<noteq> 0"
        "poly (map_poly of_int ip) bb \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aa < bb &&& poly (of_int_poly ip) aa \<noteq> 0 &&& poly (of_int_poly ip) bb \<noteq> 0
[PROOF STEP]
unfolding aa_def bb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat a < real_of_rat b &&& poly (of_int_poly ip) (real_of_rat a) \<noteq> 0 &&& poly (of_int_poly ip) (real_of_rat b) \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat a < real_of_rat b
[PROOF STEP]
by (meson False not_less of_rat_less)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly (of_int_poly ip) (real_of_rat a) \<noteq> 0
 2. poly (of_int_poly ip) (real_of_rat b) \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (of_int_poly ip) (real_of_rat a) \<noteq> 0
[PROOF STEP]
using False \<open>0 < dp\<close> ip rat_int.map_poly_R_hom_commute
[PROOF STATE]
proof (prove)
using this:
\<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0)
0 < dp
of_int_poly ip = smult dp p
poly (of_int_poly ?p) (real_of_rat ?x) = real_of_rat (poly (of_int_poly ?p) ?x)

goal (1 subgoal):
 1. poly (of_int_poly ip) (real_of_rat a) \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (of_int_poly ip) (real_of_rat b) \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (of_int_poly ip) (real_of_rat b) \<noteq> 0
[PROOF STEP]
using False \<open>0 < dp\<close> ip rat_int.map_poly_R_hom_commute
[PROOF STATE]
proof (prove)
using this:
\<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0)
0 < dp
of_int_poly ip = smult dp p
poly (of_int_poly ?p) (real_of_rat ?x) = real_of_rat (poly (of_int_poly ?p) ?x)

goal (1 subgoal):
 1. poly (of_int_poly ip) (real_of_rat b) \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
aa < bb
poly (of_int_poly ip) aa \<noteq> 0
poly (of_int_poly ip) bb \<noteq> 0

goal (1 subgoal):
 1. taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)
[PROOF STEP]
from sturm_tarski_interval[OF this]
[PROOF STATE]
proof (chain)
picking this:
taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} ?q = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * ?q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} ?q = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * ?q)

goal (1 subgoal):
 1. taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
taq {x. poly (of_int_poly ip) x = 0 \<and> aa < x \<and> x < bb} (of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "... = changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq))
[PROOF STEP]
by (simp add: of_int_hom.map_poly_pderiv of_int_poly_hom.hom_mult)
[PROOF STATE]
proof (state)
this:
changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq))

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
changes_itv_smods aa bb (of_int_poly ip) (pderiv (of_int_poly ip) * of_int_poly iq) = changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq))

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
have "... = ri_changes_itv_spmods a b ip (pderiv ip * iq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq)) = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
using rat_int.changes_spmods_smods
[PROOF STATE]
proof (prove)
using this:
ri_changes_itv_spmods ?a ?b ?p ?q = changes_itv_smods (real_of_rat ?a) (real_of_rat ?b) (of_int_poly ?p) (of_int_poly ?q)
ri_changes_R_spmods ?p ?q = changes_R_smods (of_int_poly ?p) (of_int_poly ?q)
ri_changes_gt_spmods ?a ?p ?q = changes_gt_smods (real_of_rat ?a) (of_int_poly ?p) (of_int_poly ?q)
ri_changes_le_spmods ?b ?p ?q = changes_le_smods (real_of_rat ?b) (of_int_poly ?p) (of_int_poly ?q)

goal (1 subgoal):
 1. changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq)) = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
unfolding aa_def bb_def
[PROOF STATE]
proof (prove)
using this:
ri_changes_itv_spmods ?a ?b ?p ?q = changes_itv_smods (real_of_rat ?a) (real_of_rat ?b) (of_int_poly ?p) (of_int_poly ?q)
ri_changes_R_spmods ?p ?q = changes_R_smods (of_int_poly ?p) (of_int_poly ?q)
ri_changes_gt_spmods ?a ?p ?q = changes_gt_smods (real_of_rat ?a) (of_int_poly ?p) (of_int_poly ?q)
ri_changes_le_spmods ?b ?p ?q = changes_le_smods (real_of_rat ?b) (of_int_poly ?p) (of_int_poly ?q)

goal (1 subgoal):
 1. changes_itv_smods (real_of_rat a) (real_of_rat b) (of_int_poly ip) (of_int_poly (pderiv ip * iq)) = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
changes_itv_smods aa bb (of_int_poly ip) (of_int_poly (pderiv ip * iq)) = ri_changes_itv_spmods a b ip (pderiv ip * iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
have "TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq) "
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)

goal (1 subgoal):
 1. \<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0) \<Longrightarrow> TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b ip (pderiv ip * iq)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
unfolding Let_def ip_def iq_def
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b (clear_de p) (pderiv (clear_de p) * clear_de q)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then ri_changes_itv_spmods a b (clear_de p) (pderiv (clear_de p) * clear_de q) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
TaQ_itv_rats a b p q = ri_changes_itv_spmods a b (clear_de p) (pderiv (clear_de p) * clear_de q)
\<not> (b \<le> a \<or> poly p a = 0 \<or> poly p b = 0)

goal (1 subgoal):
 1. TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then ri_changes_itv_spmods a b (clear_de p) (pderiv (clear_de p) * clear_de q) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
TaQ_itv_rats a b p q = (if b \<le> a then 0 else if poly p a \<noteq> 0 \<and> poly p b \<noteq> 0 then let ip = clear_de p; iq = clear_de q in ri_changes_itv_spmods a b ip (pderiv ip * iq) else Code.abort STR ''Roots at border yet to be supported'' (\<lambda>_. TaQ_itv_rats a b p q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordinal_times_distrib:
"x * (y + z) = (x * y) + (x * z::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y + z) = x * y + x * z
[PROOF STEP]
by (rule_tac a=z in oLimit_induct, simp_all add: ordinal_plus_assoc)


[STATEMENT]
lemma pi_approx_64:
  "abs (pi - 57952155664616982739 / 2^64 :: real) \<le> inverse (2^64)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - 57952155664616982739 / 2 ^ 64\<bar> \<le> inverse (2 ^ 64)
[PROOF STEP]
by (rule approx_coarsen[OF pi_approx_54_decimals]) simp


[STATEMENT]
lemma less_multiset_ext\<^sub>D\<^sub>M_cong[fundef_cong]:
  "(\<And>X Y k a. X \<noteq> {#} \<Longrightarrow> X \<subseteq># N \<Longrightarrow> M = (N - X) + Y \<Longrightarrow> k \<in># Y \<Longrightarrow> R k a = S k a) \<Longrightarrow>
  less_multiset_ext\<^sub>D\<^sub>M R M N = less_multiset_ext\<^sub>D\<^sub>M S M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X Y k a. \<lbrakk>X \<noteq> {#}; X \<subseteq># N; M = N - X + Y; k \<in># Y\<rbrakk> \<Longrightarrow> R k a = S k a) \<Longrightarrow> less_multiset_ext\<^sub>D\<^sub>M R M N = less_multiset_ext\<^sub>D\<^sub>M S M N
[PROOF STEP]
unfolding less_multiset_ext\<^sub>D\<^sub>M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X Y k a. \<lbrakk>X \<noteq> {#}; X \<subseteq># N; M = N - X + Y; k \<in># Y\<rbrakk> \<Longrightarrow> R k a = S k a) \<Longrightarrow> (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> R k a))) = (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> S k a)))
[PROOF STEP]
by metis


[STATEMENT]
lemma cnf_lemma: "x > 0 \<Longrightarrow> x - \<omega> ** oLog \<omega> x < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x - \<omega> ** oLog \<omega> x < x
[PROOF STEP]
apply (subst ordinal_minus_less_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < x \<Longrightarrow> \<omega> ** oLog \<omega> x \<le> x
 2. 0 < x \<Longrightarrow> x < \<omega> ** oLog \<omega> x + x
[PROOF STEP]
apply (erule ordinal_exp_oLog_le, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x < \<omega> ** oLog \<omega> x + x
[PROOF STEP]
apply (rule ordinal_less_plusL)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x < \<omega> ** oLog \<omega> x * \<omega>
[PROOF STEP]
apply (rule ordinal_less_exp_oLog, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Qp_funs_is_monoid:
"monoid (Fun\<^bsub>n\<^esub> Q\<^sub>p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
[PROOF STEP]
using F.is_monoid
[PROOF STATE]
proof (prove)
using this:
Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)

goal (1 subgoal):
 1. Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
[PROOF STEP]
by blast


[STATEMENT]
lemma fbox_g_evol[simp]:
  fixes \<phi> :: "('a::preorder) \<Rightarrow> 'b \<Rightarrow> 'b"
  shows "fb\<^sub>\<F> (EVOL \<phi> G U) Q = {s. (\<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (\<phi> \<tau> s)) \<longrightarrow> (\<phi> t s) \<in> Q)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fb\<^sub>\<F> (EVOL \<phi> G U) Q = {s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (\<phi> \<tau> s)) \<longrightarrow> s2p Q (\<phi> t s)}
[PROOF STEP]
unfolding g_evol_def g_orbit_eq ffb_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s. \<forall>s'. s2p {\<phi> t s |t. s2p (U s) t \<and> (\<forall>\<tau>\<in>down (U s) t. G (\<phi> \<tau> s))} s' \<longrightarrow> s2p Q s'} = {s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (\<phi> \<tau> s)) \<longrightarrow> s2p Q (\<phi> t s)}
[PROOF STEP]
by auto


[STATEMENT]
lemma  "rat_poly.matrix_mult [[A,1],[0,A]] [[A,0],[0,A]] = [[A*A,A],[0,A*A]] "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult [[A, 1], [0, A]] [[A, 0], [0, A]] = [[rat_poly_times A A, A], [0, rat_poly_times A A]]
[PROOF STEP]
apply(simp add:mat_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matT_vec_multI 0 rat_poly_plus rat_poly_times (map2 (#) [A, 1] (map2 (#) [0, A] (replicate (rat_poly.row_length [[A, 1], [0, A]]) []))) [A, 0] = [rat_poly_times A A, A] \<and> matT_vec_multI 0 rat_poly_plus rat_poly_times (map2 (#) [A, 1] (map2 (#) [0, A] (replicate (rat_poly.row_length [[A, 1], [0, A]]) []))) [0, A] = [0, rat_poly_times A A]
[PROOF STEP]
apply(simp add:matT_vec_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<lambda>w. scalar_prod w [A, 0]) \<circ> (\<lambda>(x, y). x # y)) (zip [A, 1] (map2 (#) [0, A] (replicate (rat_poly.row_length [[A, 1], [0, A]]) []))) = [rat_poly_times A A, A] \<and> map ((\<lambda>w. scalar_prod w [0, A]) \<circ> (\<lambda>(x, y). x # y)) (zip [A, 1] (map2 (#) [0, A] (replicate (rat_poly.row_length [[A, 1], [0, A]]) []))) = [0, rat_poly_times A A]
[PROOF STEP]
apply(auto simp add:replicate_def rat_poly.row_length_def)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. scalar_prod [A, 0] [A, 0] = rat_poly_times A A
 2. scalar_prod [1, A] [A, 0] = A
 3. scalar_prod [A, 0] [0, A] = 0
 4. scalar_prod [1, A] [0, A] = rat_poly_times A A
[PROOF STEP]
apply(auto simp add:scalar_prod)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_nat_monom:
  "of_nat = monom 0 \<circ> of_nat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat = monom 0 \<circ> of_nat
[PROOF STEP]
by (simp add: fun_eq_iff)


[STATEMENT]
lemma member_class_to_carrier:
  assumes "x \<in> (r |\<^bsub>rel\<^esub> s)" and "y \<in> (r' |\<^bsub>rel\<^esub> s')"
  shows "(fst x \<otimes> fst y, snd x \<otimes> snd y) \<in> carrier rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst x \<otimes> fst y, snd x \<otimes> snd y) \<in> carrier rel
[PROOF STEP]
using assms rel_def eq_class_of_rng_of_frac_def
[PROOF STATE]
proof (prove)
using this:
x \<in> (r |\<^bsub>rel\<^esub> s)
y \<in> (r' |\<^bsub>rel\<^esub> s')
rel \<equiv> \<lparr>carrier = carrier R \<times> S, eq = \<lambda>(r, s) (r', s'). \<exists>t\<in>S. t \<otimes> (s' \<otimes> r \<ominus> s \<otimes> r') = \<zero>\<rparr>
?r |\<^bsub>?rel\<^esub> ?s \<equiv> {(r', s'). (r', s') \<in> carrier ?rel \<and> (?r, ?s) .=\<^bsub>?rel\<^esub> (r', s')}

goal (1 subgoal):
 1. (fst x \<otimes> fst y, snd x \<otimes> snd y) \<in> carrier rel
[PROOF STEP]
by (metis (no_types, lifting) Product_Type.Collect_case_prodD m_closed mem_Sigma_iff
      partial_object.select_convs(1) semiring_simprules(3))


[STATEMENT]
lemma ipset_from_cidr_alt:
    fixes pre :: "'i::len word"
    shows "ipset_from_cidr pre len =
            {pre AND (mask len << LENGTH('i) - len)
             ..
             pre OR mask (LENGTH('i) - len)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipset_from_cidr pre len = {pre && (mask len << LENGTH('i) - len)..pre || mask (LENGTH('i) - len)}
[PROOF STEP]
apply(simp add: ipset_from_cidr_def ipset_from_netmask_def Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre && (mask len << LENGTH('i) - len) || ~~ (mask len << LENGTH('i) - len) = pre || mask (LENGTH('i) - len) \<or> \<not> pre && (mask len << LENGTH('i) - len) \<le> pre && (mask len << LENGTH('i) - len) || ~~ (mask len << LENGTH('i) - len) \<and> \<not> pre && (mask len << LENGTH('i) - len) \<le> pre || mask (LENGTH('i) - len)
[PROOF STEP]
apply(simp add: word_oa_dist)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre || ~~ (mask len << LENGTH('i) - len) = pre || mask (LENGTH('i) - len) \<or> \<not> pre && (mask len << LENGTH('i) - len) \<le> pre || ~~ (mask len << LENGTH('i) - len) \<and> \<not> pre && (mask len << LENGTH('i) - len) \<le> pre || mask (LENGTH('i) - len)
[PROOF STEP]
apply(simp add: NOT_mask_shifted_lenword)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in is_tm_iso_ntcf) cat_Funct_is_iso_arrI':
  assumes "category \<alpha> \<BB>"
    and "\<NN>' = ntcf_arrow \<NN>"
    and "\<FF>' = cf_map \<FF>"
    and "\<GG>' = cf_map \<GG>"
  shows "\<NN>' : \<FF>' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Funct \<alpha> \<AA> \<BB>\<^esub> cf_map \<GG>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<NN>' : \<FF>' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Funct \<alpha> \<AA> \<BB>\<^esub> cf_map \<GG>
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>

goal (1 subgoal):
 1. \<NN>' : \<FF>' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Funct \<alpha> \<AA> \<BB>\<^esub> cf_map \<GG>
[PROOF STEP]
unfolding assms(2-4)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>

goal (1 subgoal):
 1. ntcf_arrow \<NN> : cf_map \<FF> \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Funct \<alpha> \<AA> \<BB>\<^esub> cf_map \<GG>
[PROOF STEP]
by (rule cat_Funct_is_iso_arrI)


[STATEMENT]
lemma K0_return_eq_p0:
  assumes "is_policy p" "s \<in> space Ms"
  shows "K0 p (return Ms s) = p0 p s \<bind> (\<lambda>a. return M (s,a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K0 p (return Ms s) = p0 p s \<bind> (\<lambda>a. return M (s, a))
[PROOF STEP]
unfolding K0_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. return Ms s \<bind> (\<lambda>s. p0 p s \<bind> (\<lambda>a. return M (s, a))) = p0 p s \<bind> (\<lambda>a. return M (s, a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_policy p
s \<in> space Ms

goal (1 subgoal):
 1. return Ms s \<bind> (\<lambda>s. p0 p s \<bind> (\<lambda>a. return M (s, a))) = p0 p s \<bind> (\<lambda>a. return M (s, a))
[PROOF STEP]
by (subst bind_return[where N = M]) (auto intro!: measurable_prob_algebraD)


[STATEMENT]
lemma SA_finsum_apply_zero:
  assumes "finite S"
  assumes "F \<in> S \<rightarrow> carrier (SA n)"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "\<And>s. s \<in> S \<Longrightarrow> F s x = \<zero>"
  shows "finsum (SA n) F S x = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum (SA n) F S x = \<zero>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum (SA n) F S x = \<zero>
[PROOF STEP]
have "finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)
[PROOF STEP]
using SA_finsum_apply assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?S; ?x \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> ?F \<in> ?S \<rightarrow> carrier (SA ?n) \<longrightarrow> finsum (SA ?n) ?F ?S ?x = (\<Oplus>s\<in>?S. ?F s ?x)
finite S
F \<in> S \<rightarrow> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
?s10 \<in> S \<Longrightarrow> F ?s10 x = \<zero>

goal (1 subgoal):
 1. finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)

goal (1 subgoal):
 1. finsum (SA n) F S x = \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)

goal (1 subgoal):
 1. finsum (SA n) F S x = \<zero>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finsum (SA n) F S x = (\<Oplus>s\<in>S. F s x)
finite S
F \<in> S \<rightarrow> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
?s10 \<in> S \<Longrightarrow> F ?s10 x = \<zero>

goal (1 subgoal):
 1. finsum (SA n) F S x = \<zero>
[PROOF STEP]
by (metis Qp.add.finprod_one_eqI)
[PROOF STATE]
proof (state)
this:
finsum (SA n) F S x = \<zero>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma retract_of_space_retraction_maps:
   "S retract_of_space X \<longleftrightarrow> S \<subseteq> topspace X \<and> (\<exists>r. retraction_maps X (subtopology X S) r id)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S retract_of_space X) = (S \<subseteq> topspace X \<and> (\<exists>r. retraction_maps X (subtopology X S) r id))
[PROOF STEP]
by (auto simp: retract_of_space_def retraction_maps_def)


[STATEMENT]
lemma not_ev_not[simp]: "not (ev (not \<phi>)) = alw \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xs. \<not> ev (\<lambda>xs. \<not> \<phi> xs) xs) = alw \<phi>
[PROOF STEP]
unfolding not_ev
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alw (\<lambda>xs. \<not> \<not> \<phi> xs) = alw \<phi>
[PROOF STEP]
by simp


[STATEMENT]
lemma Nil_lenlex_iff1 [simp]: "([], ns) \<in> lenlex r \<longleftrightarrow> ns \<noteq> []"
  and Nil_lenlex_iff2 [simp]: "(ns,[]) \<notin> lenlex r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (([], ns) \<in> lenlex r) = (ns \<noteq> []) &&& (ns, []) \<notin> lenlex r
[PROOF STEP]
by (auto simp: lenlex_def)


[STATEMENT]
lemma negligible_hyperplane:
  assumes "a \<noteq> 0 \<or> b \<noteq> 0" shows "negligible {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
obtain x where x: "a \<bullet> x \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. a \<bullet> x \<noteq> b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a) \<or> b \<noteq> 0

goal (1 subgoal):
 1. (\<And>x. a \<bullet> x \<noteq> b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis euclidean_all_zero_iff inner_zero_right)
[PROOF STATE]
proof (state)
this:
a \<bullet> x \<noteq> b

goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<bullet> x \<noteq> b

goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
have "c = 1" if "a \<bullet> (x + c *\<^sub>R w) = b" "a \<bullet> (x + w) = b" for c w
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c = 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a \<bullet> (x + c *\<^sub>R w) = b
a \<bullet> (x + w) = b

goal (1 subgoal):
 1. c = 1
[PROOF STEP]
by (metis (no_types, opaque_lifting) add_diff_eq diff_0 diff_minus_eq_add inner_diff_right inner_scaleR_right mult_cancel_right2 right_minus_eq x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<bullet> (x + ?c *\<^sub>R ?w) = b; a \<bullet> (x + ?w) = b\<rbrakk> \<Longrightarrow> ?c = 1

goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<bullet> x \<noteq> b
\<lbrakk>a \<bullet> (x + ?c *\<^sub>R ?w) = b; a \<bullet> (x + ?w) = b\<rbrakk> \<Longrightarrow> ?c = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<bullet> x \<noteq> b
\<lbrakk>a \<bullet> (x + ?c *\<^sub>R ?w) = b; a \<bullet> (x + ?w) = b\<rbrakk> \<Longrightarrow> ?c = 1

goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
using starlike_negligible [OF closed_hyperplane, of x]
[PROOF STATE]
proof (prove)
using this:
a \<bullet> x \<noteq> b
\<lbrakk>a \<bullet> (x + ?c *\<^sub>R ?w) = b; a \<bullet> (x + ?w) = b\<rbrakk> \<Longrightarrow> ?c = 1
(\<And>c xa. \<lbrakk>x + c *\<^sub>R xa \<in> {x. ?a1 \<bullet> x = ?b1}; 0 \<le> c; x + xa \<in> {x. ?a1 \<bullet> x = ?b1}\<rbrakk> \<Longrightarrow> c = 1) \<Longrightarrow> negligible {x. ?a1 \<bullet> x = ?b1}

goal (1 subgoal):
 1. negligible {x. a \<bullet> x = b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
negligible {x. a \<bullet> x = b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_ldistinct: "closed {xs. ldistinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {xs. ldistinct xs}
[PROOF STEP]
unfolding closed_ccpo
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> C \<subseteq> Collect ldistinct \<longrightarrow> \<Squnion> C \<in> Collect ldistinct
[PROOF STEP]
by (auto simp: ldistinct_lSup Sup_llist_def subset_eq)


[STATEMENT]
lemma take_bit_int_greater_eq_self_iff:
  \<open>k \<le> take_bit n k \<longleftrightarrow> k < 2 ^ n\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k \<le> take_bit n k) = (k < 2 ^ n)
[PROOF STEP]
by (auto simp add: le_less take_bit_int_greater_self_iff take_bit_int_eq_self_iff
    dest: sym not_sym intro: less_trans [of k 0 \<open>2 ^ n\<close>])