[STATEMENT]
lemma commute_left_comp:
  assumes "y \<in> A" and "x\<in>A" and "z\<in>A" and "g \<in> A \<rightarrow> A"
  shows "f y (f x (g z)) = f x (f y (g z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f y (f x (g z)) = f x (f y (g z))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> A
x \<in> A
z \<in> A
g \<in> A \<rightarrow> A

goal (1 subgoal):
 1. f y (f x (g z)) = f x (f y (g z))
[PROOF STEP]
by (auto simp add: Pi_def o_assoc comp_fun_commute_restrict)


[STATEMENT]
lemma ang_vec_c_sym:
  shows "\<angle>c z1 z2 = \<angle>c z2 z1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<angle>c z1 z2 = \<angle>c z2 z1
[PROOF STEP]
unfolding ang_vec_c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<angle> z1 z2\<bar> = \<bar>\<angle> z2 z1\<bar>
[PROOF STEP]
using ang_vec_sym_pi[of z1 z2] ang_vec_sym[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
\<angle> z1 z2 = pi \<Longrightarrow> \<angle> z1 z2 = \<angle> z2 z1
\<angle> z1 z2 \<noteq> pi \<Longrightarrow> \<angle> z1 z2 = - \<angle> z2 z1

goal (1 subgoal):
 1. \<bar>\<angle> z1 z2\<bar> = \<bar>\<angle> z2 z1\<bar>
[PROOF STEP]
by (cases "\<angle> z1 z2 = pi") auto


[STATEMENT]
lemma length_int_0 [simp]: "length_int 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length_int 0 = 0
[PROOF STEP]
by (simp add: length_int_def)


[STATEMENT]
lemma fsigma_imp_gdelta: "fsigma S \<Longrightarrow> gdelta (- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fsigma S \<Longrightarrow> gdelta (- S)
[PROOF STEP]
proof (induction rule: fsigma.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>F. (\<And>n. closed (F n)) \<Longrightarrow> gdelta (- \<Union> (range F))
[PROOF STEP]
case (1 F)
[PROOF STATE]
proof (state)
this:
closed (F ?n)

goal (1 subgoal):
 1. \<And>F. (\<And>n. closed (F n)) \<Longrightarrow> gdelta (- \<Union> (range F))
[PROOF STEP]
have "- \<Union>(F ` UNIV) = (\<Inter>i. -(F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Union> (range F) = (\<Inter>i. - F i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- \<Union> (range F) = (\<Inter>i. - F i)

goal (1 subgoal):
 1. \<And>F. (\<And>n. closed (F n)) \<Longrightarrow> gdelta (- \<Union> (range F))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- \<Union> (range F) = (\<Inter>i. - F i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
- \<Union> (range F) = (\<Inter>i. - F i)

goal (1 subgoal):
 1. gdelta (- \<Union> (range F))
[PROOF STEP]
by (simp add: 1 gdelta.intros open_closed)
[PROOF STATE]
proof (state)
this:
gdelta (- \<Union> (range F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_iarray_det[code_unfold]:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "det A = det_iarrays (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
let ?f="(\<lambda>i. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
have *: "fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))
[PROOF STEP]
unfolding matrix_to_iarray_fst_Gauss_Jordan_det_P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
have "prod_list (map ?f [0..<nrows_iarray (matrix_to_iarray A)]) = prod ?f (set [0..<nrows_iarray (matrix_to_iarray A)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)
[PROOF STEP]
by (metis (no_types, lifting) distinct_upt prod.distinct_set_conv_list)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
have "... = (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)
[PROOF STEP]
proof (rule prod.reindex_cong[of "to_nat::('n=>nat)"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inj mod_type_class.to_nat
 2. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
 3. \<And>x. x \<in> UNIV \<Longrightarrow> snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
show "inj (to_nat::('n=>nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj mod_type_class.to_nat
[PROOF STEP]
by (metis strict_mono_imp_inj_on strict_mono_to_nat)
[PROOF STATE]
proof (state)
this:
inj mod_type_class.to_nat

goal (2 subgoals):
 1. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
 2. \<And>x. x \<in> UNIV \<Longrightarrow> snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
show "set [0..<nrows_iarray (matrix_to_iarray A)] = range (to_nat::'n=>nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding nrows_eq_card_rows
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
using bij_to_nat[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('n)}

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('n)}

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding atLeast0LessThan atLeast_upt
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = set [0..<CARD('n)]

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
show "snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! to_nat x !! to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
unfolding matrix_to_iarray_snd_Gauss_Jordan_det_P[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_det_P A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
unfolding matrix_to_iarray_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Gauss_Jordan_det_P A) $ x $ x = snd (Gauss_Jordan_det_P A) $ x $ x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (Gauss_Jordan_det_P A) $ x $ x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)
[PROOF STEP]
have "(\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)
  = prod_list (map (\<lambda>i. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) [0..<nrows_iarray (matrix_to_iarray A)])"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) = (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i)

goal (1 subgoal):
 1. (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)
fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. det A = det_iarrays (matrix_to_iarray A)
[PROOF STEP]
unfolding det_code_equation det_iarrays_def Let_def
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i)
fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. (\<Prod>i\<in>UNIV. snd (Gauss_Jordan_det_P A) $ i $ i) / fst (Gauss_Jordan_det_P A) = (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A)) !! i !! i) / fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
det A = det_iarrays (matrix_to_iarray A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_unique:
assumes "real_of_int a \<le> x" "x < a+1"
shows "floor x = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> = a
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
real_of_int a \<le> x
x < real_of_int (a + 1)

goal (1 subgoal):
 1. \<lfloor>x\<rfloor> = a
[PROOF STEP]
by linarith


[STATEMENT]
lemma integral_ident [simp]:
  fixes a::real
  assumes "a \<le> b"
  shows "integral {a..b} (\<lambda>x. x) = (if a \<le> b then (b\<^sup>2 - a\<^sup>2)/2 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} (\<lambda>x. x) = (if a \<le> b then (b\<^sup>2 - a\<^sup>2) / 2 else 0)
[PROOF STEP]
by (metis assms ident_has_integral integral_unique)


[STATEMENT]
lemma tendsto_of_nat_iff:
  "filterlim (\<lambda>n. of_nat (f n)) (nhds (of_nat c :: 'a :: real_normed_div_algebra)) F \<longleftrightarrow>
     eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F = (\<forall>\<^sub>F n in F. f n = c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
assume "((\<lambda>n. of_nat (f n)) \<longlongrightarrow> (of_nat c :: 'a)) F"
[PROOF STATE]
proof (state)
this:
((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F

goal (2 subgoals):
 1. ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
hence "eventually (\<lambda>n. \<bar>real (f n) - real c\<bar> < 1/2) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. \<bar>real (f n) - real c\<bar> < 1 / 2
[PROOF STEP]
by (force simp: tendsto_iff dist_of_nat dest: spec[of _ "1/2"])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. \<bar>real (f n) - real c\<bar> < 1 / 2

goal (2 subgoals):
 1. ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
thus "eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. \<bar>real (f n) - real c\<bar> < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c
[PROOF STEP]
by eventually_elim (simp add: abs_if split: if_splits)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
assume "eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
hence "eventually (\<lambda>n. of_nat (f n) = (of_nat c :: 'a)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. of_nat (f n) = of_nat c
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. of_nat (f n) = of_nat c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
thus "filterlim (\<lambda>n. of_nat (f n)) (nhds (of_nat c :: 'a)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. of_nat (f n) = of_nat c

goal (1 subgoal):
 1. ((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F
[PROOF STEP]
by (rule tendsto_eventually)
[PROOF STATE]
proof (state)
this:
((\<lambda>n. of_nat (f n)) \<longlongrightarrow> of_nat c) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_1_iff_int [simp]: "lcm m n = 1 \<longleftrightarrow> (m = 1 \<or> m = -1) \<and> (n = 1 \<or> n = -1)"
  for m n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm m n = 1) = ((m = 1 \<or> m = - 1) \<and> (n = 1 \<or> n = - 1))
[PROOF STEP]
by auto


[STATEMENT]
lemma LIMSEQ_abs_realpow_zero2: "\<bar>c\<bar> < 1 \<Longrightarrow> (\<lambda>n. c ^ n :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>c\<bar> < 1 \<Longrightarrow> (^) c \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule LIMSEQ_power_zero) simp


[STATEMENT]
lemma monad_zero_hrabs_iff: "x \<in> monad 0 \<longleftrightarrow> \<bar>x\<bar> \<in> monad 0"
  for x :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> monad 0) = (\<bar>x\<bar> \<in> monad 0)
[PROOF STEP]
using Infinitesimal_monad_zero_iff
[PROOF STATE]
proof (prove)
using this:
(?x \<in> Infinitesimal) = (?x \<in> monad 0)

goal (1 subgoal):
 1. (x \<in> monad 0) = (\<bar>x\<bar> \<in> monad 0)
[PROOF STEP]
by blast


[STATEMENT]
lemma powr_real_real:
  assumes "w \<in> \<real>" "z \<in> \<real>" "0 < Re w"
  shows "w powr z = exp(Re z * ln(Re w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w powr z = complex_of_real (exp (Re z * ln (Re w)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w powr z = complex_of_real (exp (Re z * ln (Re w)))
[PROOF STEP]
have "w \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w \<in> \<real>
z \<in> \<real>
0 < Re w

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

goal (1 subgoal):
 1. w powr z = complex_of_real (exp (Re z * ln (Re w)))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
w \<in> \<real>
z \<in> \<real>
0 < Re w
w \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w \<in> \<real>
z \<in> \<real>
0 < Re w
w \<noteq> 0

goal (1 subgoal):
 1. w powr z = complex_of_real (exp (Re z * ln (Re w)))
[PROOF STEP]
by (simp add: powr_def Ln_Reals_eq of_real_exp)
[PROOF STATE]
proof (state)
this:
w powr z = complex_of_real (exp (Re z * ln (Re w)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_univ[simp]: "infinite (UNIV :: univ set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
unfolding infinite_iff_card_of_nat card_of_ordLeq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. inj f \<and> range f \<subseteq> UNIV
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. (\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. f x = f y \<longrightarrow> x = y) \<and> range f \<subseteq> UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma nfoldli_prod_divmod_conv':
    "nfoldli [0..<M] ctd (\<lambda>i. nfoldli [0..<N] ctd (f i)) = nfoldli [0..<N*M] ctd (\<lambda>i. f (i div N) (i mod N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli [0..<M] ctd (\<lambda>i. nfoldli [0..<N] ctd (f i)) = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div N) (i mod N))
[PROOF STEP]
apply (intro ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nfoldli [0..<M] ctd (\<lambda>i. nfoldli [0..<N] ctd (f i)) x = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div N) (i mod N)) x
[PROOF STEP]
apply (subst nfoldli_nfoldli_prod_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nfoldli (List.product [0..<M] [0..<N]) ctd (\<lambda>(x, y). f x y) x = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div N) (i mod N)) x
[PROOF STEP]
by (simp add: nfoldli_prod_divmod_conv algebra_simps)


[STATEMENT]
lemma nonpos_Ints_cases:
  assumes "x \<in> \<int>\<^sub>\<le>\<^sub>0"
  obtains n where "x = of_int n" "n \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>x = of_int n; n \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>x = of_int n; n \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding nonpos_Ints_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {of_int n |n. n \<le> 0}

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>x = of_int n; n \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim!: Ints_cases)


[STATEMENT]
lemma vintersection_iff[simp]: "x \<in>\<^sub>\<circ> A \<inter>\<^sub>\<circ> B \<longleftrightarrow> x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in>\<^sub>\<circ> A \<inter>\<^sub>\<circ> B) = (x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B)
[PROOF STEP]
unfolding vintersection_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in>\<^sub>\<circ> set {x. x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B}) = (x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B)
[PROOF STEP]
by simp


[STATEMENT]
lemma subset_iprev_in_iff: "A \<subseteq> B \<Longrightarrow> (iprev n A \<in> B) = (n \<in> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> (iprev n A \<in> B) = (n \<in> B)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> B; iprev n A \<in> B\<rbrakk> \<Longrightarrow> n \<in> B
 2. \<lbrakk>A \<subseteq> B; n \<in> B\<rbrakk> \<Longrightarrow> iprev n A \<in> B
[PROOF STEP]
apply (rule subset_iprev_in_imp_in, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; n \<in> B\<rbrakk> \<Longrightarrow> iprev n A \<in> B
[PROOF STEP]
apply (rule subset_iprev_closed, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma scaleR_le_cancel_left: "c *\<^sub>R a \<le> c *\<^sub>R b \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)"
  for b :: "'a::ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c *\<^sub>R a \<le> c *\<^sub>R b) = ((0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a))
[PROOF STEP]
by (auto simp: neq_iff scaleR_left_mono scaleR_left_mono_neg
      dest: scaleR_left_mono[where a="inverse c"] scaleR_left_mono_neg[where c="inverse c"])


[STATEMENT]
lemma finite_rhs_def2:
  "finite_rhs ES = (\<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> finite rhs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_rhs ES = (\<forall>X rhs. (X, rhs) \<in> ES \<longrightarrow> finite rhs)
[PROOF STEP]
unfolding finite_rhs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>(X, rhs)\<in>ES. finite rhs) = (\<forall>X rhs. (X, rhs) \<in> ES \<longrightarrow> finite rhs)
[PROOF STEP]
by auto


[STATEMENT]
lemma differential_zero_maxmin_component:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes k: "k \<in> Basis"
    and ball: "0 < e" "(\<forall>y \<in> ball x e. (f y)\<bullet>k \<le> (f x)\<bullet>k) \<or> (\<forall>y\<in>ball x e. (f x)\<bullet>k \<le> (f y)\<bullet>k)"
    and diff: "f differentiable (at x)"
  shows "(\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)" (is "?D k = 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
let ?f' = "frechet_derivative f (at x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
have "x \<in> ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> ball x e
[PROOF STEP]
using \<open>0 < e\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

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

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> ball x e

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
have "open (ball x e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (ball x e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
open (ball x e)

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open (ball x e)

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
have "((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. ?f' h \<bullet> k)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)
[PROOF STEP]
using bounded_linear_inner_left diff[unfolded frechet_derivative_works]
[PROOF STATE]
proof (prove)
using this:
bounded_linear (\<lambda>a. a \<bullet> ?b)
(f has_derivative frechet_derivative f (at x)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)
[PROOF STEP]
by (rule bounded_linear.has_derivative)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> ball x e
open (ball x e)
((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)
[PROOF STEP]
have "(\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)"
[PROOF STATE]
proof (prove)
using this:
x \<in> ball x e
open (ball x e)
((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)

goal (1 subgoal):
 1. (\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)
[PROOF STEP]
using ball(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> ball x e
open (ball x e)
((\<lambda>x. f x \<bullet> k) has_derivative (\<lambda>h. frechet_derivative f (at x) h \<bullet> k)) (at x)
(\<forall>y\<in>ball x e. f y \<bullet> k \<le> f x \<bullet> k) \<or> (\<forall>y\<in>ball x e. f x \<bullet> k \<le> f y \<bullet> k)

goal (1 subgoal):
 1. (\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)
[PROOF STEP]
by (rule differential_zero_maxmin)
[PROOF STATE]
proof (state)
this:
(\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>h. frechet_derivative f (at x) h \<bullet> k) = (\<lambda>v. 0)

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>xa. frechet_derivative f (at x) xa \<bullet> k = 0

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm019:
  assumes "card X\<ge>1" "\<forall>x\<in>X. y > x"
  shows "y > Max X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max X < y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> card X
\<forall>x\<in>X. x < y

goal (1 subgoal):
 1. Max X < y
[PROOF STEP]
by (metis (poly_guards_query) Max_in One_nat_def card_eq_0_iff lessI not_le)


[STATEMENT]
lemma (in group) l_cancel_one [simp]: "x \<in> carrier G \<Longrightarrow> a \<in> carrier G \<Longrightarrow> x \<otimes> a = x \<longleftrightarrow> a = one G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; a \<in> carrier G\<rbrakk> \<Longrightarrow> (x \<otimes> a = x) = (a = \<one>)
[PROOF STEP]
by (metis Units_eq Units_l_cancel monoid.r_one monoid_axioms one_closed)


[STATEMENT]
lemma walk_edges_append_union: "xs \<noteq> [] \<Longrightarrow> ys \<noteq> [] \<Longrightarrow>
    set (walk_edges (xs@ys)) = set (walk_edges (xs)) \<union> set (walk_edges ys) \<union> {{last xs, hd ys}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; ys \<noteq> []\<rbrakk> \<Longrightarrow> set (walk_edges (xs @ ys)) = set (walk_edges xs) \<union> set (walk_edges ys) \<union> {{last xs, hd ys}}
[PROOF STEP]
using walk_edges_singleton_app
[PROOF STATE]
proof (prove)
using this:
?ys \<noteq> [] \<Longrightarrow> walk_edges ([?x] @ ?ys) = {?x, hd ?ys} # walk_edges ?ys

goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; ys \<noteq> []\<rbrakk> \<Longrightarrow> set (walk_edges (xs @ ys)) = set (walk_edges xs) \<union> set (walk_edges ys) \<union> {{last xs, hd ys}}
[PROOF STEP]
by (induct xs rule: walk_edges.induct) auto


[STATEMENT]
lemma norm_summable_fps:
  fixes f :: "'a :: {banach, real_normed_div_algebra} fps"
  shows "norm z < fps_conv_radius f \<Longrightarrow> summable (\<lambda>n. norm (fps_nth f n * z ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (norm z) < fps_conv_radius f \<Longrightarrow> summable (\<lambda>n. norm (fps_nth f n * z ^ n))
[PROOF STEP]
by (rule abs_summable_in_conv_radius) (simp_all add: fps_conv_radius_def)


[STATEMENT]
lemma card_sumset_singleton_eq:
  assumes "finite A" shows "card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
proof (cases "a \<in> G")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
 2. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<in> G

goal (2 subgoals):
 1. a \<in> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
 2. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> G
[PROOF STEP]
have "sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)"
[PROOF STATE]
proof (prove)
using this:
a \<in> G

goal (1 subgoal):
 1. sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)
[PROOF STEP]
by (auto simp: sumset_eq)
[PROOF STATE]
proof (state)
this:
sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)

goal (2 subgoals):
 1. a \<in> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
 2. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)

goal (2 subgoals):
 1. a \<in> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
 2. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
have "inj_on (\<lambda>x. x \<oplus> a) (A \<inter> G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. x \<oplus> a) (A \<inter> G)
[PROOF STEP]
by (auto simp: inj_on_def True)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. x \<oplus> a) (A \<inter> G)

goal (2 subgoals):
 1. a \<in> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
 2. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)
inj_on (\<lambda>x. x \<oplus> a) (A \<inter> G)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sumset A {a} = (\<lambda>x. x \<oplus> a) ` (A \<inter> G)
inj_on (\<lambda>x. x \<oplus> a) (A \<inter> G)

goal (1 subgoal):
 1. card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
by (metis True card_image)
[PROOF STATE]
proof (state)
this:
card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)

goal (1 subgoal):
 1. a \<notin> G \<Longrightarrow> card (sumset A {a}) = (if a \<in> G then card (A \<inter> G) else 0)
[PROOF STEP]
qed (auto simp: sumset_eq)


[STATEMENT]
lemma isTrue_neg_excl:
"\<phi> \<in> fmla \<Longrightarrow> Fvars \<phi> = {} \<Longrightarrow>
 isTrue \<phi> \<Longrightarrow> isTrue (neg \<phi>) \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; Fvars \<phi> = {}; isTrue \<phi>; isTrue (neg \<phi>)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using isTrue_imp not_isTrue_fls
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<phi> \<in> fmla; ?\<psi> \<in> fmla; Fvars ?\<phi> = {}; Fvars ?\<psi> = {}; isTrue ?\<phi>; isTrue (imp ?\<phi> ?\<psi>)\<rbrakk> \<Longrightarrow> isTrue ?\<psi>
\<not> isTrue fls

goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; Fvars \<phi> = {}; isTrue \<phi>; isTrue (neg \<phi>)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
unfolding neg_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<phi> \<in> fmla; ?\<psi> \<in> fmla; Fvars ?\<phi> = {}; Fvars ?\<psi> = {}; isTrue ?\<phi>; isTrue (imp ?\<phi> ?\<psi>)\<rbrakk> \<Longrightarrow> isTrue ?\<psi>
\<not> isTrue fls

goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; Fvars \<phi> = {}; isTrue \<phi>; isTrue (imp \<phi> fls)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto


[STATEMENT]
theorem Gamma_fact: "Gamma (1 + of_nat n) = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma ((1::'a) + of_nat n) = fact n
[PROOF STEP]
by (simp add: pochhammer_fact pochhammer_Gamma of_nat_in_nonpos_Ints_iff flip: of_nat_Suc)


[STATEMENT]
lemma monoidI:
  fixes G (structure)
  assumes m_closed:
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
    and one_closed: "\<one> \<in> carrier G"
    and m_assoc:
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
    and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
    and r_one: "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x"
  shows "monoid G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.monoid G
[PROOF STEP]
by (fast intro!: monoid.intro intro: assms)


[STATEMENT]
theorem hta_prod_correct:
  assumes TA: "hashedTa H1" "hashedTa H2"
  shows
    "ta_lang (hta_\<alpha> (hta_prod H1 H2))
     = ta_lang (hta_\<alpha> H1) \<inter> ta_lang (hta_\<alpha> H2)"
    "hashedTa (hta_prod H1 H2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (hta_\<alpha> (hta_prod H1 H2)) = ta_lang (hta_\<alpha> H1) \<inter> ta_lang (hta_\<alpha> H2) &&& hashedTa (hta_prod H1 H2)
[PROOF STEP]
by (simp_all add: hta_prod_correct_aux[OF TA] ta_prod_correct_aux1)


[STATEMENT]
lemma additive_content_tagged_division:
  "d tagged_division_of (cbox a b) \<Longrightarrow> sum (\<lambda>(x,l). content l) d = content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d tagged_division_of cbox a b \<Longrightarrow> (\<Sum>(x, y)\<in>d. content y) = content (cbox a b)
[PROOF STEP]
by (fact sum_content.tagged_division)


[STATEMENT]
lemma preal_add_mult_distrib: "(((x::preal) + y) * w) = (x * w) + (y * w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) * w = x * w + y * w
[PROOF STEP]
by (simp add: preal_mult_commute preal_add_mult_distrib2)


[STATEMENT]
lemma "((A \<or> B) \<and> (A \<longrightarrow> C) \<and> (B \<longrightarrow> C)) \<longrightarrow> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<or> B) \<and> (A \<longrightarrow> C) \<and> (B \<longrightarrow> C) \<longrightarrow> C
[PROOF STEP]
apply prop_solver
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pow_generator_eq_iff_cong:
  "finite (carrier G) \<Longrightarrow> \<^bold>g [^] x = \<^bold>g [^] y \<longleftrightarrow> [x = y] (mod order G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier G) \<Longrightarrow> (\<^bold>g [^] x = \<^bold>g [^] y) = [x = y] (mod order G)
[PROOF STEP]
by(subst (1 2) pow_generator_mod[symmetric])(auto simp add: cong_def order_gt_0_iff_finite intro: inj_onD[OF inj_on_generator])


[STATEMENT]
lemma is_red_union: "is_red (A \<union> B) p \<longleftrightarrow> (is_red A p \<or> is_red B p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_red (A \<union> B) p = (is_red A p \<or> is_red B p)
[PROOF STEP]
unfolding is_red_alt red_union
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>q. red A p q \<or> red B p q) = (Ex (red A p) \<or> Ex (red B p))
[PROOF STEP]
by auto


[STATEMENT]
lemma Sup_enat_minus1:
  assumes "m \<noteq> \<infinity>"
  shows "\<Squnion>A - m = \<Squnion>((\<lambda>n :: enat. n - m) ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> A - m = (\<Squnion>n\<in>A. n - m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Squnion> A - m = (\<Squnion>n\<in>A. n - m)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> \<infinity>
[PROOF STEP]
obtain m' where "m = enat m'"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<And>m'. m = enat m' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = enat m'

goal (1 subgoal):
 1. \<Squnion> A - m = (\<Squnion>n\<in>A. n - m)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m = enat m'

goal (1 subgoal):
 1. \<Squnion> A - m = (\<Squnion>n\<in>A. n - m)
[PROOF STEP]
by(auto simp add: Sup_enat_def Max_enat_minus1 finite_lessThan_enat_iff enat_diff_cancel_left inj_on_def dest!: finite_imageD2[where B="{..<enat m'}"])
[PROOF STATE]
proof (state)
this:
\<Squnion> A - m = (\<Squnion>n\<in>A. n - m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_add1_eq_if: "
  (a + b) mod (m::nat) = (
  if (a mod m + b mod m < m) then a mod m + b mod m
  else a mod m + b mod m - m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b) mod m = (if a mod m + b mod m < m then a mod m + b mod m else a mod m + b mod m - m)
[PROOF STEP]
by (simp add: mod_add_eq[symmetric, of a b] mod_add_mod_if)


[STATEMENT]
theorem hoare_assume:
  "(\<Turnstile> P {| [.R.] |} Q) = (P \<sqinter> R \<le> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Turnstile> P{| [. R .] |}Q = (P \<sqinter> R \<sqsubseteq> Q)
[PROOF STEP]
apply (simp add: Hoare_def assume_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<sqsubseteq> - R \<squnion> Q) = (P \<sqinter> R \<sqsubseteq> Q)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. P \<sqsubseteq> - R \<squnion> Q \<Longrightarrow> P \<sqinter> R \<sqsubseteq> Q
 2. P \<sqinter> R \<sqsubseteq> Q \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
apply (case_tac "(inf P R) \<le> (inf (sup (- R) Q) R)")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>P \<sqsubseteq> - R \<squnion> Q; P \<sqinter> R \<sqsubseteq> (- R \<squnion> Q) \<sqinter> R\<rbrakk> \<Longrightarrow> P \<sqinter> R \<sqsubseteq> Q
 2. \<lbrakk>P \<sqsubseteq> - R \<squnion> Q; \<not> P \<sqinter> R \<sqsubseteq> (- R \<squnion> Q) \<sqinter> R\<rbrakk> \<Longrightarrow> P \<sqinter> R \<sqsubseteq> Q
 3. P \<sqinter> R \<sqsubseteq> Q \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
apply (simp add: inf_sup_distrib2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>P \<sqsubseteq> - R \<squnion> Q; \<not> P \<sqinter> R \<sqsubseteq> (- R \<squnion> Q) \<sqinter> R\<rbrakk> \<Longrightarrow> P \<sqinter> R \<sqsubseteq> Q
 2. P \<sqinter> R \<sqsubseteq> Q \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
apply (simp add: le_infI1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<sqinter> R \<sqsubseteq> Q \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
apply (case_tac "(sup (-R) (inf P R)) \<le> sup (- R) Q")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>P \<sqinter> R \<sqsubseteq> Q; - R \<squnion> P \<sqinter> R \<sqsubseteq> - R \<squnion> Q\<rbrakk> \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
 2. \<lbrakk>P \<sqinter> R \<sqsubseteq> Q; \<not> - R \<squnion> P \<sqinter> R \<sqsubseteq> - R \<squnion> Q\<rbrakk> \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
apply (simp add: sup_inf_distrib1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P \<sqinter> R \<sqsubseteq> Q; \<not> - R \<squnion> P \<sqinter> R \<sqsubseteq> - R \<squnion> Q\<rbrakk> \<Longrightarrow> P \<sqsubseteq> - R \<squnion> Q
[PROOF STEP]
by (simp add: le_supI2)


[STATEMENT]
lemma poly_mult_closed:
  assumes "subring K R"
  shows "\<lbrakk> polynomial K p1; polynomial K p2 \<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polynomial K p1; polynomial K p2\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2)
[PROOF STEP]
using poly_mult_is_polynomial polynomial_incl assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring ?K R; set ?p1.0 \<subseteq> ?K; set ?p2.0 \<subseteq> ?K\<rbrakk> \<Longrightarrow> polynomial ?K (poly_mult ?p1.0 ?p2.0)
polynomial ?K ?p \<Longrightarrow> set ?p \<subseteq> ?K
subring K R

goal (1 subgoal):
 1. \<lbrakk>polynomial K p1; polynomial K p2\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2)
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_y_x_poly_lift:
  fixes p :: "'a :: comm_monoid_add poly"
  shows "poly_y_x (poly_lift p) = [:p:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_y_x (poly_lift p) = [:p:]
[PROOF STEP]
apply(subst poly_y_x_fix_y_deg[of _ 0],force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>degree (poly_lift p). \<Sum>j\<le>0. monom (monom (coeff (coeff (poly_lift p) i) j) i) j) = [:p:]
[PROOF STEP]
apply(subst(10) poly_as_sum_of_monoms[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>degree (poly_lift p). \<Sum>j\<le>0. monom (monom (coeff (coeff (poly_lift p) i) j) i) j) = [:\<Sum>i\<le>degree p. monom (coeff p i) i:]
[PROOF STEP]
by (auto simp add: monom_sum monom_0 hom_distribs)


[STATEMENT]
lemma (in Group) ex_redchainTr4:"\<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n)\<rbrakk> \<Longrightarrow>
                card (f ` {i. i \<le> (Suc n)}) = Suc (card (f ` {i. i \<le> n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n)\<rbrakk> \<Longrightarrow> card (f ` {i. i \<le> Suc n}) = Suc (card (f ` {i. i \<le> n}))
[PROOF STEP]
apply (cut_tac image_Nset_Suc [of "f" "n"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n); f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})\<rbrakk> \<Longrightarrow> card (f ` {i. i \<le> Suc n}) = Suc (card (f ` {i. i \<le> n}))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n); f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})\<rbrakk> \<Longrightarrow> card (insert (f (Suc n)) (f ` {i. i \<le> n})) = Suc (card (f ` {i. i \<le> n}))
[PROOF STEP]
apply (rule card_insert_disjoint)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n); f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})\<rbrakk> \<Longrightarrow> finite (f ` {i. i \<le> n})
 2. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n); f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})\<rbrakk> \<Longrightarrow> f (Suc n) \<notin> f ` {i. i \<le> n}
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G (Suc n) f; f n \<noteq> f (Suc n); f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})\<rbrakk> \<Longrightarrow> f (Suc n) \<notin> f ` {i. i \<le> n}
[PROOF STEP]
apply (simp add:last_mem_excluded)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma homotopy_equivalent_space_imp_isomorphic_homology_groups:
   "X homotopy_equivalent_space Y \<Longrightarrow> homology_group p X \<cong> homology_group p Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X homotopy_equivalent_space Y \<Longrightarrow> homology_group p X \<cong> homology_group p Y
[PROOF STEP]
unfolding homotopy_equivalent_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f g. continuous_map X Y f \<and> continuous_map Y X g \<and> homotopic_with (\<lambda>x. True) X X (g \<circ> f) id \<and> homotopic_with (\<lambda>x. True) Y Y (f \<circ> g) id \<Longrightarrow> homology_group p X \<cong> homology_group p Y
[PROOF STEP]
by (auto intro: homotopy_equivalent_space_imp_isomorphic_relative_homology_groups)


[STATEMENT]
lemma polyhedron_halfspace_le:
  fixes a :: "'a :: euclidean_space"
  shows "polyhedron {x. a \<bullet> x \<le> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
 2. a \<noteq> (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = (0::'a)

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
 2. a \<noteq> (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = (0::'a)

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

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x \<le> b}
[PROOF STEP]
unfolding polyhedron_def
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>F. finite F \<and> {x. a \<bullet> x \<le> b} = \<Inter> F \<and> (\<forall>h\<in>F. \<exists>a b. a \<noteq> (0::'a) \<and> h = {x. a \<bullet> x \<le> b})
[PROOF STEP]
by (rule_tac x="{{x. a \<bullet> x \<le> b}}" in exI) auto
[PROOF STATE]
proof (state)
this:
polyhedron {x. a \<bullet> x \<le> b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_power_int [continuous_intros]:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_div_algebra"
  assumes "continuous_on s f" and "\<forall>x\<in>s. f x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. power_int (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powi n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powi n)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. f x powi n) \<longlongrightarrow> f x powi n) (at x within s)
[PROOF STEP]
by (blast intro: tendsto_power_int)


[STATEMENT]
lemma (in prob_space) discounted_integrable:
  assumes "integrable N (X n)"
  and "-1 < r"
  and "space N = space M"
  shows "integrable N (discounted_value r X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable N (discounted_value r X n)
[PROOF STEP]
unfolding discounted_value_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
have "\<exists>c> 0. \<forall>w \<in> space M.  (discount_factor r n) w = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c>0. \<forall>w\<in>space M. discount_factor r n w = c
[PROOF STEP]
using discount_factor_constant_time_pos assms
[PROOF STATE]
proof (prove)
using this:
- 1 < ?r \<Longrightarrow> \<exists>c>0. \<forall>w\<in>space M. discount_factor ?r ?n w = c
integrable N (X n)
- 1 < r
space N = space M

goal (1 subgoal):
 1. \<exists>c>0. \<forall>w\<in>space M. discount_factor r n w = c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>c>0. \<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>c>0. \<forall>w\<in>space M. discount_factor r n w = c
[PROOF STEP]
obtain c where "c > 0" and "\<forall>w \<in> space M.  (discount_factor r n) w = c"
[PROOF STATE]
proof (prove)
using this:
\<exists>c>0. \<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>0 < c; \<forall>w\<in>space M. discount_factor r n w = c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < c
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
note cprops = this
[PROOF STATE]
proof (state)
this:
0 < c
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
hence "\<forall>w \<in> space M. discount_factor r n w = c"
[PROOF STATE]
proof (prove)
using this:
0 < c
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. \<forall>w\<in>space M. discount_factor r n w = c
[PROOF STEP]
using cprops
[PROOF STATE]
proof (prove)
using this:
0 < c
\<forall>w\<in>space M. discount_factor r n w = c
0 < c
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. \<forall>w\<in>space M. discount_factor r n w = c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
hence "\<forall>w \<in> space N. discount_factor r n w = c"
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>space M. discount_factor r n w = c

goal (1 subgoal):
 1. \<forall>w\<in>space N. discount_factor r n w = c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>space M. discount_factor r n w = c
integrable N (X n)
- 1 < r
space N = space M

goal (1 subgoal):
 1. \<forall>w\<in>space N. discount_factor r n w = c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>space N. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
thus "integrable N (\<lambda>w. discount_factor r n w * X n w)"
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>space N. discount_factor r n w = c

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
using \<open>\<forall>w \<in> space N. discount_factor r n w = c\<close> assms
    Bochner_Integration.integrable_cong[of N N "(\<lambda>w. discount_factor r n w * X n w)" "(\<lambda>w. c * X n w)"]
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>space N. discount_factor r n w = c
\<forall>w\<in>space N. discount_factor r n w = c
integrable N (X n)
- 1 < r
space N = space M
\<lbrakk>N = N; \<And>x. x \<in> space N \<Longrightarrow> discount_factor r n x * X n x = c * X n x\<rbrakk> \<Longrightarrow> integrable N (\<lambda>w. discount_factor r n w * X n w) = integrable N (\<lambda>w. c * X n w)

goal (1 subgoal):
 1. integrable N (\<lambda>w. discount_factor r n w * X n w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable N (\<lambda>w. discount_factor r n w * X n w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_extensional_prod_nat:
  assumes "finite A" "b > 0"
  shows   "finite {d \<in> extensional A. prod d A = (b :: nat)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {d \<in> extensional A. prod d A = b}
[PROOF STEP]
proof (rule finite_subset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show "finite (PiE A (\<lambda>_. {..b}))"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (A \<rightarrow>\<^sub>E {..b})
[PROOF STEP]
by (rule finite_PiE) auto
[PROOF STATE]
proof (state)
this:
finite (A \<rightarrow>\<^sub>E {..b})

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite (A \<rightarrow>\<^sub>E {..b})

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
fix d :: "'a \<Rightarrow> nat" and x :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
assume *: "x \<in> A" "prod d A = b"
[PROOF STATE]
proof (state)
this:
x \<in> A
prod d A = b

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
with prod_dvd_prod_subset[of A "{x}" d] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite A; {x} \<subseteq> A\<rbrakk> \<Longrightarrow> prod d {x} dvd prod d A
finite A
0 < b
x \<in> A
prod d A = b
[PROOF STEP]
have "d x dvd b"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite A; {x} \<subseteq> A\<rbrakk> \<Longrightarrow> prod d {x} dvd prod d A
finite A
0 < b
x \<in> A
prod d A = b

goal (1 subgoal):
 1. d x dvd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d x dvd b

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
0 < b
d x dvd b
[PROOF STEP]
have "d x \<le> b"
[PROOF STATE]
proof (prove)
using this:
finite A
0 < b
d x dvd b

goal (1 subgoal):
 1. d x \<le> b
[PROOF STEP]
by (auto dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
d x \<le> b

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x2 \<in> A; prod ?d2 A = b\<rbrakk> \<Longrightarrow> ?d2 ?x2 \<le> b

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
thus "{d \<in> extensional A. prod d A = (b :: nat)} \<subseteq> \<dots>"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x2 \<in> A; prod ?d2 A = b\<rbrakk> \<Longrightarrow> ?d2 ?x2 \<le> b

goal (1 subgoal):
 1. {d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}
[PROOF STEP]
by (auto simp: extensional_def)
[PROOF STATE]
proof (state)
this:
{d \<in> extensional A. prod d A = b} \<subseteq> A \<rightarrow>\<^sub>E {..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem ax1: "\<turnstile> \<box>F \<longrightarrow> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>F \<longrightarrow> F
[PROOF STEP]
proof (clarsimp simp: always_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. \<forall>n. F (w |\<^sub>s n) \<Longrightarrow> F w
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. \<forall>n. F (w |\<^sub>s n) \<Longrightarrow> F w
[PROOF STEP]
assume "\<forall>n. (w |\<^sub>s n) \<Turnstile> F"
[PROOF STATE]
proof (state)
this:
\<forall>n. F (w |\<^sub>s n)

goal (1 subgoal):
 1. \<And>w. \<forall>n. F (w |\<^sub>s n) \<Longrightarrow> F w
[PROOF STEP]
hence "(w |\<^sub>s 0) \<Turnstile> F"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. F (w |\<^sub>s n)

goal (1 subgoal):
 1. F (w |\<^sub>s 0)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
F (w |\<^sub>s 0)

goal (1 subgoal):
 1. \<And>w. \<forall>n. F (w |\<^sub>s n) \<Longrightarrow> F w
[PROOF STEP]
thus "w \<Turnstile> F"
[PROOF STATE]
proof (prove)
using this:
F (w |\<^sub>s 0)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iterator_to_ordered_iterator_quicksort_correct :
assumes lin : "\<And>x y. (R x y) \<or> (R y x)"
    and trans_R: "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
    and it_OK: "set_iterator it S0"
shows "set_iterator_genord (iterator_to_ordered_iterator_quicksort R it) S0 R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_genord (iterator_to_ordered_iterator_quicksort R it) S0 R
[PROOF STEP]
unfolding iterator_to_ordered_iterator_quicksort_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_genord (iterator_to_ordered_iterator (quicksort_by_rel R []) it) S0 R
[PROOF STEP]
apply (rule iterator_to_ordered_iterator_correct [OF _ it_OK])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. sorted_wrt R (quicksort_by_rel R [] l) \<and> mset (quicksort_by_rel R [] l) = mset l
[PROOF STEP]
apply (simp_all add: sorted_wrt_quicksort_by_rel[OF lin trans_R])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma birkhoff_sum_cocycle:
  "birkhoff_sum f (n+m) x = birkhoff_sum f n x + birkhoff_sum f m ((T^^n)x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
have "(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>i<m. f ((T ^^ (i+n)) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>i<m. f ((T ^^ (i + n)) x))
[PROOF STEP]
by (simp add: funpow_add)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>i<m. f ((T ^^ (i + n)) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>i<m. f ((T ^^ (i + n)) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
have "... = (\<Sum>j\<in>{n..< m+n}. f ((T ^^j) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<m. f ((T ^^ (i + n)) x)) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))
[PROOF STEP]
using atLeast0LessThan sum.shift_bounds_nat_ivl[where ?g = "\<lambda>j. f((T^^j)x)" and ?k = n and ?m = 0 and ?n = m, symmetric]
          add.commute add.left_neutral
[PROOF STATE]
proof (prove)
using this:
{0..<?n} = {..<?n}
(\<Sum>i = 0..<m. f ((T ^^ (i + n)) x)) = (\<Sum>j = 0 + n..<m + n. f ((T ^^ j) x))
?a + ?b = ?b + ?a
(0::?'a) + ?a = ?a

goal (1 subgoal):
 1. (\<Sum>i<m. f ((T ^^ (i + n)) x)) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<m. f ((T ^^ (i + n)) x)) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))
[PROOF STEP]
have *: "birkhoff_sum f m ((T^^n)x) = (\<Sum>j\<in>{n..< m+n}. f ((T ^^j) x))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))

goal (1 subgoal):
 1. birkhoff_sum f m ((T ^^ n) x) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))

goal (1 subgoal):
 1. (\<Sum>i<m. f ((T ^^ i) ((T ^^ n) x))) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
birkhoff_sum f m ((T ^^ n) x) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
have "birkhoff_sum f (n+m) x = (\<Sum>i<n. f((T^^i)x)) + (\<Sum>i\<in>{n..<m+n}. f((T^^i)x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n + m. f ((T ^^ i) x)) = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
[PROOF STEP]
by (metis add.commute add.right_neutral atLeast0LessThan le_add2 sum.atLeastLessThan_concat)
[PROOF STATE]
proof (state)
this:
birkhoff_sum f (n + m) x = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
birkhoff_sum f (n + m) x = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
have "... = birkhoff_sum f n x + (\<Sum>i\<in>{n..<m+n}. f((T^^i)x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x)) = birkhoff_sum f n x + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x)) = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i = n..<m + n. f ((T ^^ i) x)) = birkhoff_sum f n x + (\<Sum>i = n..<m + n. f ((T ^^ i) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum f (n + m) x = birkhoff_sum f n x + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f (n + m) x = birkhoff_sum f n x + (\<Sum>i = n..<m + n. f ((T ^^ i) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f (n + m) x = birkhoff_sum f n x + (\<Sum>i = n..<m + n. f ((T ^^ i) x))
birkhoff_sum f m ((T ^^ n) x) = (\<Sum>j = n..<m + n. f ((T ^^ j) x))

goal (1 subgoal):
 1. birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
birkhoff_sum f (n + m) x = birkhoff_sum f n x + birkhoff_sum f m ((T ^^ n) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindependent_ket:
  "cindependent (range (ket::'a\<Rightarrow>_))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
define S where "S = range (ket::'a\<Rightarrow>_)"
[PROOF STATE]
proof (state)
this:
S = range ket

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
have "is_ortho_set S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_ortho_set S
[PROOF STEP]
unfolding S_def is_ortho_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>range ket. \<forall>y\<in>range ket. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> 0 \<notin> range ket
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_ortho_set S

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_ortho_set S

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
have "0 \<notin> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> S
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> range ket
[PROOF STEP]
using ket_nonzero
[PROOF STATE]
proof (prove)
using this:
ket ?i \<noteq> 0

goal (1 subgoal):
 1. 0 \<notin> range ket
[PROOF STEP]
by (simp add: image_iff)
[PROOF STATE]
proof (state)
this:
0 \<notin> S

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
is_ortho_set S
0 \<notin> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_ortho_set S
0 \<notin> S

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
using is_ortho_set_cindependent[where A = S]
[PROOF STATE]
proof (prove)
using this:
is_ortho_set S
0 \<notin> S
is_ortho_set S \<Longrightarrow> cindependent S

goal (1 subgoal):
 1. cindependent (range ket)
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
is_ortho_set (range ket)
0 \<notin> range ket
is_ortho_set (range ket) \<Longrightarrow> cindependent (range ket)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_sum_minus_distrib:
  fixes f g :: "nat \<Rightarrow> complex mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> (\<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d)
    \<Longrightarrow> matrix_sum d (\<lambda>k. (f k) - (g k)) n = matrix_sum d f n - matrix_sum d g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
have eq: "-1 \<cdot>\<^sub>m g k = - g k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<cdot>\<^sub>m g k = - g k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- 1 \<cdot>\<^sub>m g ?k = - g ?k

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
assume dfk: "\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d" and dgk: "\<And>k. k < n \<Longrightarrow> (g k) \<in> carrier_mat d d"
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> g ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> g ?k \<in> carrier_mat d d
[PROOF STEP]
have "k < n \<Longrightarrow> (f k) - (g k) = (f k) + (- (g k))" for k
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> g ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. k < n \<Longrightarrow> f k - g k = f k + - g k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> f ?k - g ?k = f ?k + - g ?k

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < n \<Longrightarrow> f ?k - g ?k = f ?k + - g ?k
[PROOF STEP]
have "matrix_sum d (\<lambda>k. (f k) - (g k)) n = matrix_sum d (\<lambda>k. (f k) + (- (g k))) n"
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k - g ?k = f ?k + - g ?k

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d (\<lambda>k. f k + - g k) n
[PROOF STEP]
using matrix_sum_cong[of n "\<lambda>k. (f k) - (g k)"] dfk dgk
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k - g ?k = f ?k + - g ?k
(\<And>k. k < n \<Longrightarrow> f k - g k = ?f' k) \<Longrightarrow> matrix_sum ?d (\<lambda>k. f k - g k) n = matrix_sum ?d ?f' n
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> g ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d (\<lambda>k. f k + - g k) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d (\<lambda>k. f k + - g k) n

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d (\<lambda>k. f k + - g k) n

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
have "\<dots> = matrix_sum d f n + matrix_sum d (\<lambda>k. - (g k)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. f k + - g k) n = matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n
[PROOF STEP]
using matrix_sum_add_distrib[of n "f"] dfk dgk
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat ?d ?d; \<And>k. k < n \<Longrightarrow> ?g k \<in> carrier_mat ?d ?d\<rbrakk> \<Longrightarrow> matrix_sum ?d (\<lambda>k. f k + ?g k) n = matrix_sum ?d f n + matrix_sum ?d ?g n
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> g ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. f k + - g k) n = matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. f k + - g k) n = matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. f k + - g k) n = matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
have "\<dots> = matrix_sum d f n - matrix_sum d g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
apply (subgoal_tac "matrix_sum d (\<lambda>k. - (g k)) n = - matrix_sum d g n", auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. - g k) n = - matrix_sum d g n
[PROOF STEP]
apply (subgoal_tac "- 1 \<cdot>\<^sub>m matrix_sum d g n = - matrix_sum d g n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. - 1 \<cdot>\<^sub>m matrix_sum d g n = - matrix_sum d g n \<Longrightarrow> matrix_sum d (\<lambda>k. - g k) n = - matrix_sum d g n
 2. - 1 \<cdot>\<^sub>m matrix_sum d g n = - matrix_sum d g n
[PROOF STEP]
by (simp add: matrix_sum_smult[of n g d "-1", OF dgk, simplified eq, simplified], auto)
[PROOF STATE]
proof (state)
this:
matrix_sum d f n + matrix_sum d (\<lambda>k. - g k) n = matrix_sum d f n - matrix_sum d g n

goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. f k - g k) n = matrix_sum d f n - matrix_sum d g n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lincomb_list_as_mat_mult:
  assumes "\<forall>w \<in> set ws. dim_vec w = n"
  shows "lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c" (is "?l ws c = ?r ws c")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c
[PROOF STEP]
proof (insert assms, induct ws arbitrary: c)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c. \<forall>w\<in>set []. dim_vec w = n \<Longrightarrow> lincomb_list c [] = mat_of_cols n [] *\<^sub>v vec (length []) c
 2. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>set []. dim_vec w = n

goal (2 subgoals):
 1. \<And>c. \<forall>w\<in>set []. dim_vec w = n \<Longrightarrow> lincomb_list c [] = mat_of_cols n [] *\<^sub>v vec (length []) c
 2. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>w\<in>set []. dim_vec w = n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>set []. dim_vec w = n

goal (1 subgoal):
 1. lincomb_list c [] = mat_of_cols n [] *\<^sub>v vec (length []) c
[PROOF STEP]
by (auto simp: mult_mat_vec_def scalar_prod_def)
[PROOF STATE]
proof (state)
this:
lincomb_list c [] = mat_of_cols n [] *\<^sub>v vec (length []) c

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
case (Cons w ws)
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list ?c1 ws = mat_of_cols n ws *\<^sub>v vec (length ws) ?c1
\<forall>w\<in>set (w # ws). dim_vec w = n

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list ?c1 ws = mat_of_cols n ws *\<^sub>v vec (length ws) ?c1
\<forall>w\<in>set (w # ws). dim_vec w = n

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
assume i: "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
have "?l (w#ws) c = c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list c (w # ws) = c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)
[PROOF STEP]
by (simp add: Cons o_def)
[PROOF STATE]
proof (state)
this:
lincomb_list c (w # ws) = c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb_list c (w # ws) = c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
have "\<dots> $ i = ?r (w#ws) c $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i
[PROOF STEP]
using Cons i index_smult_vec
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list ?c1 ws = mat_of_cols n ws *\<^sub>v vec (length ws) ?c1
\<forall>w\<in>set (w # ws). dim_vec w = n
i < n
?i < dim_vec ?v \<Longrightarrow> (?a \<cdot>\<^sub>v ?v) $ ?i = ?a * ?v $ ?i
dim_vec (?a \<cdot>\<^sub>v ?v) = dim_vec ?v

goal (1 subgoal):
 1. (c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i
[PROOF STEP]
by (simp add: mat_of_cols_Cons_index_0 mat_of_cols_Cons_index_Suc o_def vec_Suc mult_mat_vec_def row_def length_Cons)
[PROOF STATE]
proof (state)
this:
(c 0 \<cdot>\<^sub>v w + mat_of_cols n ws *\<^sub>v vec (length ws) (c \<circ> Suc)) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lincomb_list c (w # ws) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i
[PROOF STEP]
have "?l (w#ws) c $ i = \<dots>"
[PROOF STATE]
proof (prove)
using this:
lincomb_list c (w # ws) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i

goal (1 subgoal):
 1. lincomb_list c (w # ws) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lincomb_list c (w # ws) $ i = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ i

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i3 < n \<Longrightarrow> lincomb_list c (w # ws) $ ?i3 = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ ?i3

goal (1 subgoal):
 1. \<And>a ws c. \<lbrakk>\<And>c. \<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list c ws = mat_of_cols n ws *\<^sub>v vec (length ws) c; \<forall>w\<in>set (a # ws). dim_vec w = n\<rbrakk> \<Longrightarrow> lincomb_list c (a # ws) = mat_of_cols n (a # ws) *\<^sub>v vec (length (a # ws)) c
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
\<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list ?c1 ws = mat_of_cols n ws *\<^sub>v vec (length ws) ?c1
\<forall>w\<in>set (w # ws). dim_vec w = n
?i3 < n \<Longrightarrow> lincomb_list c (w # ws) $ ?i3 = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ ?i3
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>set ws. dim_vec w = n \<Longrightarrow> lincomb_list ?c1 ws = mat_of_cols n ws *\<^sub>v vec (length ws) ?c1
\<forall>w\<in>set (w # ws). dim_vec w = n
?i3 < n \<Longrightarrow> lincomb_list c (w # ws) $ ?i3 = (mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c) $ ?i3

goal (1 subgoal):
 1. lincomb_list c (w # ws) = mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c
[PROOF STEP]
by (intro eq_vecI, auto)
[PROOF STATE]
proof (state)
this:
lincomb_list c (w # ws) = mat_of_cols n (w # ws) *\<^sub>v vec (length (w # ws)) c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_le_zero:
  assumes "x \<in> {pi/2..3*pi/2}"
  shows   "cos x \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<le> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x \<le> 0
[PROOF STEP]
have "cos x = -cos (x - pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = - cos (x - pi)
[PROOF STEP]
by (simp add: cos_diff)
[PROOF STATE]
proof (state)
this:
cos x = - cos (x - pi)

goal (1 subgoal):
 1. cos x \<le> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cos x = - cos (x - pi)

goal (1 subgoal):
 1. cos x \<le> 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> {pi / 2..3 * pi / 2}
[PROOF STEP]
have "cos (x - pi) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> {pi / 2..3 * pi / 2}

goal (1 subgoal):
 1. 0 \<le> cos (x - pi)
[PROOF STEP]
by (intro cos_ge_zero) auto
[PROOF STATE]
proof (state)
this:
0 \<le> cos (x - pi)

goal (1 subgoal):
 1. cos x \<le> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cos x = - cos (x - pi)
0 \<le> cos (x - pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x = - cos (x - pi)
0 \<le> cos (x - pi)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_columnI:
  assumes "\<And>i. column i A = column i B"
  shows "(A::real^'n^'n) = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
column ?i A = column ?i B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
apply vector
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. column i A = column i B) \<Longrightarrow> \<forall>i ia. A $ i $ ia = B $ i $ ia
[PROOF STEP]
apply (auto simp: column_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. (\<And>i. (\<lambda>ia. A $ ia $ i) = (\<lambda>ia. B $ ia $ i)) \<Longrightarrow> A $ i $ ia = B $ i $ ia
[PROOF STEP]
apply vector
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. (\<And>i. (\<lambda>ia. A $ ia $ i) = (\<lambda>ia. B $ ia $ i)) \<Longrightarrow> A $ i $ ia = B $ i $ ia
[PROOF STEP]
by (metis iso_tuple_UNIV_I vec_lambda_inject)


[STATEMENT]
lemma subseteq_qle_trans: "A \<subseteq>\<^sub>\<preceq> B \<Longrightarrow> B \<subseteq>\<^sub>\<preceq> C \<Longrightarrow> A \<subseteq>\<^sub>\<preceq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq>\<^sub>\<preceq> B; B \<subseteq>\<^sub>\<preceq> C\<rbrakk> \<Longrightarrow> A \<subseteq>\<^sub>\<preceq> C
[PROOF STEP]
by (simp add: subseteq_qle_def in_qle_def) (metis qle_trans)


[STATEMENT]
lemma poly_reflect_poly_nz:
  "x \<noteq> 0 \<Longrightarrow> poly (reflect_poly p) x = x ^ degree p * poly p (inverse x)"
  for x :: "'a::field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> poly (reflect_poly p) x = x ^ degree p * poly p (inverse x)
[PROOF STEP]
by (induct rule: pCons_induct) (simp_all add: field_simps reflect_poly_pCons' poly_monom)


[STATEMENT]
lemma euclidean_size_gcd_le1 [simp]:
  assumes "a \<noteq> 0"
  shows "euclidean_size (gcd a b) \<le> euclidean_size a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
from gcd_dvd1
[PROOF STATE]
proof (chain)
picking this:
gcd ?a ?b dvd ?a
[PROOF STEP]
obtain c where A: "a = gcd a b * c"
[PROOF STATE]
proof (prove)
using this:
gcd ?a ?b dvd ?a

goal (1 subgoal):
 1. (\<And>c. a = gcd a b * c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a = gcd a b * c

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
a = gcd a b * c
[PROOF STEP]
have "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)
a = gcd a b * c

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

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have "euclidean_size (gcd a b) \<le> euclidean_size (gcd a b * c)"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size (gcd a b * c)
[PROOF STEP]
by (rule size_mult_mono)
[PROOF STATE]
proof (state)
this:
euclidean_size (gcd a b) \<le> euclidean_size (gcd a b * c)

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
a = gcd a b * c
euclidean_size (gcd a b) \<le> euclidean_size (gcd a b * c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = gcd a b * c
euclidean_size (gcd a b) \<le> euclidean_size (gcd a b * c)

goal (1 subgoal):
 1. euclidean_size (gcd a b) \<le> euclidean_size a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
euclidean_size (gcd a b) \<le> euclidean_size a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_mtx3: "(0::3 sq_mtx) = diag3 0 0 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = diag3 0 0 0
[PROOF STEP]
by (simp add: sq_mtx_eq_iff)


[STATEMENT]
lemma iMin_le_Max: "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> iMin A \<le> Max A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> iMin A \<le> Max A
[PROOF STEP]
by (rule ssubst[OF iMin_Min_conv], assumption+, rule Min_le_Max)


[STATEMENT]
lemma decides_subsets_subset: "\<lbrakk>decides_subsets \<F> M; N \<subseteq> M\<rbrakk> \<Longrightarrow> decides_subsets \<F> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>decides_subsets \<F> M; N \<subseteq> M\<rbrakk> \<Longrightarrow> decides_subsets \<F> N
[PROOF STEP]
by (meson decides_subset decides_subsets_def subset_trans)


[STATEMENT]
lemma ln_Gamma_series_complex_of_real:
  "x > 0 \<Longrightarrow> n > 0 \<Longrightarrow> ln_Gamma_series (complex_of_real x) n = of_real (ln_Gamma_series x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < n\<rbrakk> \<Longrightarrow> ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < n\<rbrakk> \<Longrightarrow> ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)
[PROOF STEP]
assume xn: "x > 0" "n > 0"
[PROOF STATE]
proof (state)
this:
0 < x
0 < n

goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < n\<rbrakk> \<Longrightarrow> ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)
[PROOF STEP]
have "Ln (complex_of_real x / of_nat k + 1) = of_real (ln (x / of_nat k + 1))" if "k \<ge> 1" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (complex_of_real x / of_nat k + 1) = complex_of_real (ln (x / real k + 1))
[PROOF STEP]
using that xn
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
0 < x
0 < n

goal (1 subgoal):
 1. Ln (complex_of_real x / of_nat k + 1) = complex_of_real (ln (x / real k + 1))
[PROOF STEP]
by (subst Ln_of_real [symmetric]) (auto intro!: add_nonneg_pos simp: field_simps)
[PROOF STATE]
proof (state)
this:
1 \<le> ?k \<Longrightarrow> Ln (complex_of_real x / of_nat ?k + 1) = complex_of_real (ln (x / real ?k + 1))

goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < n\<rbrakk> \<Longrightarrow> ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)
[PROOF STEP]
with xn
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 < n
1 \<le> ?k \<Longrightarrow> Ln (complex_of_real x / of_nat ?k + 1) = complex_of_real (ln (x / real ?k + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < n
1 \<le> ?k \<Longrightarrow> Ln (complex_of_real x / of_nat ?k + 1) = complex_of_real (ln (x / real ?k + 1))

goal (1 subgoal):
 1. ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)
[PROOF STEP]
by (simp add: ln_Gamma_series_def Ln_of_real)
[PROOF STATE]
proof (state)
this:
ln_Gamma_series (complex_of_real x) n = complex_of_real (ln_Gamma_series x n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proots_count_power_n_n:
  shows "proots_count ([:- a, 1:]^n) s = (if a\<in>s \<and> n>0 then n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
have "proots_within ([:- a, 1:] ^ n) s= (if a\<in>s \<and> n>0 then {a} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then {a} else {})
[PROOF STEP]
unfolding proots_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> s. poly ([:- a, 1::'a:] ^ n) x = (0::'a)} = (if a \<in> s \<and> 0 < n then {a} else {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then {a} else {})

goal (1 subgoal):
 1. proots_count ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then {a} else {})

goal (1 subgoal):
 1. proots_count ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then {a} else {})

goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within ([:- a, 1::'a:] ^ n) s. order r ([:- a, 1::'a:] ^ n)) = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
using order_power_n_n
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then {a} else {})
order ?a ([:- ?a, 1::?'a:] ^ ?n) = ?n

goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within ([:- a, 1::'a:] ^ n) s. order r ([:- a, 1::'a:] ^ n)) = (if a \<in> s \<and> 0 < n then n else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count ([:- a, 1::'a:] ^ n) s = (if a \<in> s \<and> 0 < n then n else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_bernpoly:
  "(bernpoly (Suc n) has_field_derivative
     (of_nat (n + 1) * bernpoly n x :: 'a :: real_normed_field)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
have "(bernpoly (Suc n) has_field_derivative
          (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) *
            of_real (bernoulli k)))) (at x)" (is "(_ has_field_derivative ?D) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)
[PROOF STEP]
unfolding bernpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>k\<le>Suc n. of_nat (Suc n choose k) * of_real (bernoulli k) * x ^ (Suc n - k)) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)
[PROOF STEP]
by (rule DERIV_cong) (fast intro!: derivative_intros, simp)
[PROOF STATE]
proof (state)
this:
(bernpoly (Suc n) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)

goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(bernpoly (Suc n) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)

goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
have "?D = of_nat (n + 1) * bernpoly n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k))) = of_nat (n + 1) * bernpoly n x
[PROOF STEP]
unfolding bernpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k))) = of_nat (n + 1) * (\<Sum>k\<le>n. of_nat (n choose k) * of_real (bernoulli k) * x ^ (n - k))
[PROOF STEP]
by (subst sum_distrib_left, intro sum.cong refl, subst of_nat_binomial_Suc) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k))) = of_nat (n + 1) * bernpoly n x

goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(bernpoly (Suc n) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)
(\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k))) = of_nat (n + 1) * bernpoly n x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(bernpoly (Suc n) has_field_derivative (\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k)))) (at x)
(\<Sum>k\<le>n. of_nat (Suc n - k) * x ^ (n - k) * (of_nat (Suc n choose k) * of_real (bernoulli k))) = of_nat (n + 1) * bernpoly n x

goal (1 subgoal):
 1. (bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)
[PROOF STEP]
by (auto simp del: of_nat_Suc One_nat_def)
[PROOF STATE]
proof (state)
this:
(bernpoly (Suc n) has_field_derivative of_nat (n + 1) * bernpoly n x) (at x)

goal:
No subgoals!
[PROOF STEP]
qed