[STATEMENT]
lemma substdbasis_expansion_unique:
  includes inner_syntax
  assumes d: "d \<subseteq> Basis"
  shows "(\<Sum>i\<in>d. f i *\<^sub>R i) = (x::'a::euclidean_space) \<longleftrightarrow>
    (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
have *: "\<And>x a b P. x * (if P then a else b) = (if P then x * a else x * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a b P. x * (if P then a else b) = (if P then x * a else x * b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x * (if ?P then ?a else ?b) = (if ?P then ?x * ?a else ?x * ?b)

goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
have **: "finite d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite d
[PROOF STEP]
by (auto intro: finite_subset[OF assms])
[PROOF STATE]
proof (state)
this:
finite d

goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
have ***: "\<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
d \<subseteq> Basis

goal (1 subgoal):
 1. \<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)
[PROOF STEP]
by (auto intro!: sum.cong simp: inner_Basis inner_sum_left)
[PROOF STATE]
proof (state)
this:
?i1 \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> ?i1 = (\<Sum>x\<in>d. if x = ?i1 then f x else 0)

goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
unfolding euclidean_eq_iff[where 'a='a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>b\<in>Basis. (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> b = x \<bullet> b) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))
[PROOF STEP]
by (auto simp: sum.delta[OF **] ***)
[PROOF STATE]
proof (state)
this:
((\<Sum>i\<in>d. f i *\<^sub>R i) = x) = (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_edges_graph:  "card E \<le> (card V)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_size \<le> order\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. graph_size \<le> order\<^sup>2
[PROOF STEP]
have "card E \<le> card V choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_size \<le> order choose 2
[PROOF STEP]
by (metis fin_all_edges finV card_all_edges card_mono wellformed_all_edges)
[PROOF STATE]
proof (state)
this:
graph_size \<le> order choose 2

goal (1 subgoal):
 1. graph_size \<le> order\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
graph_size \<le> order choose 2

goal (1 subgoal):
 1. graph_size \<le> order\<^sup>2
[PROOF STEP]
by (metis binomial_le_pow le0 neq0_conv order.trans zero_less_binomial_iff)
[PROOF STATE]
proof (state)
this:
graph_size \<le> order\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fib_1 [simp]: "fib 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib 1 = 1
[PROOF STEP]
by (metis One_nat_def fib1)


[STATEMENT]
lemma locally_compact_alt:
  fixes S :: "'a :: heine_borel set"
  shows "locally compact S \<longleftrightarrow>
         (\<forall>x \<in> S. \<exists>U. x \<in> U \<and>
                    openin (top_of_set S) U \<and> compact(closure U) \<and> closure U \<subseteq> S)"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally compact S = (\<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. locally compact S \<Longrightarrow> \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S
 2. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S \<Longrightarrow> locally compact S
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
locally compact S

goal (2 subgoals):
 1. locally compact S \<Longrightarrow> \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S
 2. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S \<Longrightarrow> locally compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
locally compact S
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
locally compact S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S
[PROOF STEP]
by (meson bounded_subset closure_minimal compact_closure compact_imp_bounded
              compact_imp_closed dual_order.trans locally_compactE)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S \<Longrightarrow> locally compact S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S \<Longrightarrow> locally compact S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S \<Longrightarrow> locally compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>U. x \<in> U \<and> openin (top_of_set S) U \<and> compact (closure U) \<and> closure U \<subseteq> S

goal (1 subgoal):
 1. locally compact S
[PROOF STEP]
by (meson closure_subset locally_compact)
[PROOF STATE]
proof (state)
this:
locally compact S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_part_nonzero:
  "n \<noteq> 0 \<Longrightarrow> square_part n = normalize (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> (0::'a) \<Longrightarrow> square_part n = normalize (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n div 2))
[PROOF STEP]
by (simp add: square_part_def)


[STATEMENT]
lemma map_list_update [simp]:
  "\<lbrakk> x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow>
  (map f xs) [length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x:=v)) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> set []; distinct []\<rbrakk> \<Longrightarrow> (map f [])[length (takeWhile (\<lambda>z. z \<noteq> x) []) := v] = map (f(x := v)) []
 2. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs; x \<in> set (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> (map f (a # xs))[length (takeWhile (\<lambda>z. z \<noteq> x) (a # xs)) := v] = map (f(x := v)) (a # xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs; x \<in> set (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> (map f (a # xs))[length (takeWhile (\<lambda>z. z \<noteq> x) (a # xs)) := v] = map (f(x := v)) (a # xs)
[PROOF STEP]
apply (rename_tac a xs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs; x \<in> set (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> (map f (a # xs))[length (takeWhile (\<lambda>z. z \<noteq> x) (a # xs)) := v] = map (f(x := v)) (a # xs)
[PROOF STEP]
apply (case_tac "x=a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs; x \<in> set (a # xs); distinct (a # xs); x = a\<rbrakk> \<Longrightarrow> (map f (a # xs))[length (takeWhile (\<lambda>z. z \<noteq> x) (a # xs)) := v] = map (f(x := v)) (a # xs)
 2. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; distinct xs\<rbrakk> \<Longrightarrow> (map f xs)[length (takeWhile (\<lambda>z. z \<noteq> x) xs) := v] = map (f(x := v)) xs; x \<in> set (a # xs); distinct (a # xs); x \<noteq> a\<rbrakk> \<Longrightarrow> (map f (a # xs))[length (takeWhile (\<lambda>z. z \<noteq> x) (a # xs)) := v] = map (f(x := v)) (a # xs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bin_rest_XOR [simp]: "(\<lambda>k::int. k div 2) (x XOR y) = (\<lambda>k::int. k div 2) x XOR (\<lambda>k::int. k div 2) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x XOR y) div 2 = x div 2 XOR y div 2
[PROOF STEP]
by (subst xor_int_rec) auto


[STATEMENT]
lemma bouncing_ball_inv:
  fixes h::real
  shows "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow> \<lceil>\<lambda>s. s$1 = h \<and> s$2 = 0\<rceil> \<le>
  wp
    (LOOP
      ((x\<acute>= f g & (\<lambda> s. s$1 \<ge> 0) DINV (\<lambda>s. 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0));
       (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
    INV (\<lambda>s. 0 \<le> s$1 \<and> 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0)
  ) \<lceil>\<lambda>s. 0 \<le> s$1 \<and> s$1 \<le> h\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. s $ 1 = h \<and> s $ 2 = 0\<rceil> \<subseteq> wp (LOOP x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. {t. 0 \<le> t} UNIV @ 0 DINV \<lambda>s. 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h - s $ 2 \<cdot> s $ 2 = 0  ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h - s $ 2 \<cdot> s $ 2 = 0) ) \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h\<rceil>
[PROOF STEP]
apply(rule wp_loopI, simp_all, force simp: bb_real_arith)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2\<rceil> \<subseteq> wp x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. Collect ((\<le>) 0) UNIV @ 0 DINV \<lambda>s. 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2  \<lceil>\<lambda>s. (s $ 1 = 0 \<longrightarrow> - (2 \<cdot> g \<cdot> h) = s $ 2 \<cdot> s $ 2) \<and> (s $ 1 = 0 \<or> 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2)\<rceil>
[PROOF STEP]
by (rule wp_g_odei) (auto intro!: poly_derivatives diff_invariant_rules)

\<comment> \<open>Verified with annotated dynamics. \<close>


[STATEMENT]
lemma primmultgreater: fixes p::nat shows "\<lbrakk> prime p; prime q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p*q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (simp add: prime_nat_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < p \<and> (\<forall>m. m dvd p \<longrightarrow> m = Suc 0 \<or> m = p); Suc 0 < q \<and> (\<forall>m. m dvd q \<longrightarrow> m = Suc 0 \<or> m = q); p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (insert mult_le_mono [of 2 p 2 q])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < p \<and> (\<forall>m. m dvd p \<longrightarrow> m = Suc 0 \<or> m = p); Suc 0 < q \<and> (\<forall>m. m dvd q \<longrightarrow> m = Suc 0 \<or> m = q); p \<noteq> 2; q \<noteq> 2; \<lbrakk>2 \<le> p; 2 \<le> q\<rbrakk> \<Longrightarrow> 2 * 2 \<le> p * q\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Max_mono: "\<lbrakk> mono f; \<exists>x. x \<in> A; finite A \<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply (unfold mono_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y; finite A; x \<in> A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply (frule Max_in, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y; finite A; x \<in> A; Max A \<in> A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply (rule Max_equality, clarsimp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma power_tendsto_0_iff [simp]:
  fixes f :: "'a \<Rightarrow> real"
  assumes "n > 0"
  shows "((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<longleftrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F
[PROOF STEP]
have "((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F
[PROOF STEP]
by (auto simp: assms root_abs_power tendsto_rabs_zero_iff)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F
[PROOF STEP]
have "((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F
[PROOF STEP]
by (metis tendsto_real_root abs_0 real_root_zero tendsto_rabs)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F
[PROOF STEP]
by (auto simp: tendsto_null_power)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subringE:
  assumes "subring H R"
  shows "H \<subseteq> carrier R"
    and "\<zero>\<^bsub>R\<^esub> \<in> H"
    and "\<one>\<^bsub>R\<^esub> \<in> H"
    and "H \<noteq> {}"
    and "\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (H \<subseteq> carrier R &&& \<zero>\<^bsub>R\<^esub> \<in> H &&& \<one>\<^bsub>R\<^esub> \<in> H) &&& (H \<noteq> {} &&& (\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H)) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H)
[PROOF STEP]
using subring.axioms[OF assms]
[PROOF STATE]
proof (prove)
using this:
subgroup H (add_monoid R)
submonoid H R

goal (1 subgoal):
 1. (H \<subseteq> carrier R &&& \<zero>\<^bsub>R\<^esub> \<in> H &&& \<one>\<^bsub>R\<^esub> \<in> H) &&& (H \<noteq> {} &&& (\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H)) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H)
[PROOF STEP]
unfolding submonoid_def subgroup_def a_inv_def
[PROOF STATE]
proof (prove)
using this:
(H \<subseteq> carrier (add_monoid R) \<and> (\<forall>x y. x \<in> H \<longrightarrow> y \<in> H \<longrightarrow> x \<otimes>\<^bsub>add_monoid R\<^esub> y \<in> H)) \<and> \<one>\<^bsub>add_monoid R\<^esub> \<in> H \<and> (\<forall>x. x \<in> H \<longrightarrow> inv\<^bsub>add_monoid R\<^esub> x \<in> H)
H \<subseteq> carrier R \<and> (\<forall>x y. x \<in> H \<longrightarrow> y \<in> H \<longrightarrow> x \<otimes>\<^bsub>R\<^esub> y \<in> H) \<and> \<one>\<^bsub>R\<^esub> \<in> H

goal (1 subgoal):
 1. (H \<subseteq> carrier R &&& \<zero>\<^bsub>R\<^esub> \<in> H &&& \<one>\<^bsub>R\<^esub> \<in> H) &&& (H \<noteq> {} &&& (\<And>h. h \<in> H \<Longrightarrow> inv\<^bsub>add_monoid R\<^esub> h \<in> H)) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H) &&& (\<And>h1 h2. \<lbrakk>h1 \<in> H; h2 \<in> H\<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H)
[PROOF STEP]
by auto


[STATEMENT]
lemma countable_PiE:
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> countable (F i)) \<Longrightarrow> countable (Pi\<^sub>E I F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> countable (F i)\<rbrakk> \<Longrightarrow> countable (Pi\<^sub>E I F)
[PROOF STEP]
by (induct I arbitrary: F rule: finite_induct) (auto simp: PiE_insert_eq)


[STATEMENT]
lemma interior_negations:
  fixes S :: "'a::euclidean_space set"
  shows "interior(uminus ` S) = image uminus (interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (uminus ` S) = uminus ` interior S
[PROOF STEP]
by (simp add: bij_uminus interior_bijective_linear_image linear_uminus)


[STATEMENT]
lemma nat_pow_is_Zp_continuous:
  assumes "is_Zp_continuous f"
  shows "is_Zp_continuous (f[^]\<^bsub>Fun Zp\<^esub>(n::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> n)
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> 0)
 2. \<And>n. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> n) \<Longrightarrow> is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> Suc n)
[PROOF STEP]
using constant_is_Zp_continuous function_one_is_constant
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier Zp \<Longrightarrow> is_Zp_continuous (\<cc>\<^bsub>Zp\<^esub> ?a)
\<cc>\<^bsub>Zp\<^esub> \<one> = \<one>\<^bsub>function_ring (carrier Zp) Zp\<^esub>

goal (2 subgoals):
 1. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> 0)
 2. \<And>n. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> n) \<Longrightarrow> is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> Suc n)
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> n) \<Longrightarrow> is_Zp_continuous (f [^]\<^bsub>function_ring (carrier Zp) Zp\<^esub> Suc n)
[PROOF STEP]
by (simp add: assms prod_of_cont_is_cont)


[STATEMENT]
lemma wordinterval_compress:
    "wordinterval_to_set (wordinterval_compress r) = wordinterval_to_set r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (wordinterval_compress r) = wordinterval_to_set r
[PROOF STEP]
unfolding wordinterval_compress_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
have interval_of': "interval_of s = (case s of (s,e) \<Rightarrow> {s .. e})" for s
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_of s = (case s of (s, e) \<Rightarrow> {s..e})
[PROOF STEP]
by (cases s) (simp add: interval_of.simps)
[PROOF STATE]
proof (state)
this:
interval_of ?s1 = (case ?s1 of (s, e) \<Rightarrow> {s..e})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
have "wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent
              (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) =
            (\<Union>x\<in>set (listwordinterval_adjacent (listwordinterval_compress
                (wi2l (wordinterval_optimize_empty r)))). interval_of x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = \<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))
[PROOF STEP]
by (force simp: interval_of' l2wi)
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = \<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = \<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
have "\<dots> =  (\<Union>s\<in>set (wi2l (wordinterval_optimize_empty r)). interval_of s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r))))) = \<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r)))
[PROOF STEP]
by(simp add: listwordinterval_compress listwordinterval_adjacent)
[PROOF STATE]
proof (state)
this:
\<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r))))) = \<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r)))

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Union> (interval_of ` set (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r))))) = \<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r)))

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
have "\<dots> = (\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r))) = (\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j})
[PROOF STEP]
by(simp add: interval_of')
[PROOF STATE]
proof (state)
this:
\<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r))) = (\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Union> (interval_of ` set (wi2l (wordinterval_optimize_empty r))) = (\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
have "\<dots> = wordinterval_to_set r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j}) = wordinterval_to_set r
[PROOF STEP]
by(simp add: wi2l)
[PROOF STATE]
proof (state)
this:
(\<Union>(i, j)\<in>set (wi2l (wordinterval_optimize_empty r)). {i..j}) = wordinterval_to_set r

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
show "wordinterval_to_set
        (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress
            (wi2l (wordinterval_optimize_empty r))))))
          = wordinterval_to_set r"
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r

goal (1 subgoal):
 1. wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (l2wi (remdups (listwordinterval_adjacent (listwordinterval_compress (wi2l (wordinterval_optimize_empty r)))))) = wordinterval_to_set r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powhr_mult: "\<And>a x y. 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> (x * y) powhr a = (x powhr a) * (y powhr a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x y. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> (x * y) powhr a = x powhr a * y powhr a
[PROOF STEP]
by transfer (simp add: powr_mult)


[STATEMENT]
lemma symmetric_not_admissable: "\<Lambda> * (\<v> - 1) \<noteq> \<k> * (\<k> - 1) \<Longrightarrow> \<not> symmetric_bibd \<V> \<B> \<k> \<Lambda>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Lambda> * (\<v> - 1) \<noteq> \<k> * (\<k> - 1) \<Longrightarrow> \<not> symmetric_bibd \<V> \<B> \<k> \<Lambda>
[PROOF STEP]
using symmetric_bibd.symmetric_condition_2
[PROOF STATE]
proof (prove)
using this:
symmetric_bibd ?point_set ?block_collection ?u_block_size ?index \<Longrightarrow> ?index * (card ?point_set - 1) = ?u_block_size * (?u_block_size - 1)

goal (1 subgoal):
 1. \<Lambda> * (\<v> - 1) \<noteq> \<k> * (\<k> - 1) \<Longrightarrow> \<not> symmetric_bibd \<V> \<B> \<k> \<Lambda>
[PROOF STEP]
by blast


[STATEMENT]
lemma sum_minus_one:
  "(\<Sum>x \<in> {1..y}. (- 1 :: real) ^ (x + 1)) = (if odd y then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x = 1..y. (- 1) ^ (x + 1)) = (if odd y then 1 else 0)
[PROOF STEP]
by (induction y) simp_all


[STATEMENT]
lemma cspan_tensor_op: \<open>cspan {tensor_op (butterket i j) (butterket k l)| i (j::_::finite) k (l::_::finite). True} = UNIV\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cspan {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True} = UNIV
[PROOF STEP]
unfolding tensor_butter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cspan {butterket (i, k) (j, l) |i j k l. True} = UNIV
[PROOF STEP]
apply (subst cspan_butterfly_ket[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cspan {butterket (i, k) (j, l) |i j k l. True} = cspan {butterket i j |i j. True}
[PROOF STEP]
by (metis surj_pair)


[STATEMENT]
lemma rank_HUnion_less:  "x \<noteq> 0 \<Longrightarrow> rank (\<Squnion>x) < rank x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> rank (\<Squnion>x) < rank x
[PROOF STEP]
apply (induct x rule: hf_induct, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<noteq> 0 \<Longrightarrow> rank (\<Squnion>x) < rank x; y \<noteq> 0 \<Longrightarrow> rank (\<Squnion>y) < rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank x < rank y \<squnion> succ (rank x)
 2. \<And>x y. \<lbrakk>x \<noteq> 0 \<Longrightarrow> rank (\<Squnion>x) < rank x; y \<noteq> 0 \<Longrightarrow> rank (\<Squnion>y) < rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (\<Squnion>y) < rank y \<squnion> succ (rank x)
[PROOF STEP]
apply (metis hmem_hinsert rank_hinsert rank_lt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> 0 \<Longrightarrow> rank (\<Squnion>x) < rank x; y \<noteq> 0 \<Longrightarrow> rank (\<Squnion>y) < rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (\<Squnion>y) < rank y \<squnion> succ (rank x)
[PROOF STEP]
apply (metis HUnion_hempty Ord_lt_succ_iff_le Ord_rank hunion_hempty_right
               less_supI1 less_supI2 rank_sup sup.cobounded2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma upset_anti_iff: "(\<up>y \<subseteq> \<up>x) = (x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<up> y \<subseteq> \<up> x) = (x \<le> y)
[PROOF STEP]
by (metis downset_iso_iff ord_dual upset_to_downset3 subset_image_iff upset_faithful)


[STATEMENT]
lemma space_PiF: "space (PiF I M) = (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (Pi\<^sub>F I M) = (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j))
[PROOF STEP]
unfolding PiF_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (sigma (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j)) {Pi' J X |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}) = (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j))
[PROOF STEP]
using PiF_gen_subset
[PROOF STATE]
proof (prove)
using this:
{Pi' J X |X J. J \<in> ?I \<and> X \<in> (\<Pi> j\<in>J. sets (?M j))} \<subseteq> Pow (\<Union>J\<in>?I. \<Pi>' j\<in>J. space (?M j))

goal (1 subgoal):
 1. space (sigma (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j)) {Pi' J X |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}) = (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j))
[PROOF STEP]
by (rule space_measure_of)


[STATEMENT]
lemma zero_less_divide_1_iff [simp]:
  "0 < 1 / a \<longleftrightarrow> 0 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < (1::'a) / a) = ((0::'a) < a)
[PROOF STEP]
by (simp add: local.dual_order.strict_iff_order)


[STATEMENT]
lemma set_of_k_words_bound:
shows "card (set_of_k_words_length_m k m) \<le> b^m" (is "?c \<le> ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
have card_w_len_m_bound: "card (cw_len_concat-`{m}) \<le> b^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (cw_len_concat -` {m})) \<le> b ^ m
[PROOF STEP]
by (metis (no_types, lifting) am_inj_code bool_list_fin bool_lists_card card_image card_mono
    img_inc of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
real (card (cw_len_concat -` {m})) \<le> b ^ m

goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
have "set_of_k_words_length_m k m \<subseteq> (cw_len_concat)-`{m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_k_words_length_m k m \<subseteq> cw_len_concat -` {m}
[PROOF STEP]
by (simp add: set_of_k_words_length_m_def)
[PROOF STATE]
proof (state)
this:
set_of_k_words_length_m k m \<subseteq> cw_len_concat -` {m}

goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
hence "card (set_of_k_words_length_m k m) \<le> card ((cw_len_concat)-`{m})"
[PROOF STATE]
proof (prove)
using this:
set_of_k_words_length_m k m \<subseteq> cw_len_concat -` {m}

goal (1 subgoal):
 1. card (set_of_k_words_length_m k m) \<le> card (cw_len_concat -` {m})
[PROOF STEP]
by (metis (no_types, lifting) am_inj_code bool_list_fin card.infinite card_0_eq
    card_image card_mono empty_iff finite_subset img_inc inf_img_fin_dom)
[PROOF STATE]
proof (state)
this:
card (set_of_k_words_length_m k m) \<le> card (cw_len_concat -` {m})

goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (set_of_k_words_length_m k m) \<le> card (cw_len_concat -` {m})

goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
using card_w_len_m_bound
[PROOF STATE]
proof (prove)
using this:
card (set_of_k_words_length_m k m) \<le> card (cw_len_concat -` {m})
real (card (cw_len_concat -` {m})) \<le> b ^ m

goal (1 subgoal):
 1. real (card (set_of_k_words_length_m k m)) \<le> b ^ m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (set_of_k_words_length_m k m)) \<le> b ^ m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_count_atmost_1':
  "distinct xs = (\<forall>a. count (mset xs) a \<le> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
have "count (mset xs) x = (if x \<in> set xs then 1 else 0) \<longleftrightarrow> count (mset xs) x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (count (mset xs) x = (if x \<in> set xs then 1 else 0)) = (count (mset xs) x \<le> 1)
[PROOF STEP]
using count_eq_zero_iff[of "mset xs" x]
[PROOF STATE]
proof (prove)
using this:
(count (mset xs) x = 0) = (x \<notin># mset xs)

goal (1 subgoal):
 1. (count (mset xs) x = (if x \<in> set xs then 1 else 0)) = (count (mset xs) x \<le> 1)
[PROOF STEP]
by (cases "count (mset xs) x") (auto simp del: count_mset_0_iff)
[PROOF STATE]
proof (state)
this:
(count (mset xs) x = (if x \<in> set xs then 1 else 0)) = (count (mset xs) x \<le> 1)

goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(count (mset xs) ?x2 = (if ?x2 \<in> set xs then 1 else 0)) = (count (mset xs) ?x2 \<le> 1)

goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(count (mset xs) ?x2 = (if ?x2 \<in> set xs then 1 else 0)) = (count (mset xs) ?x2 \<le> 1)

goal (1 subgoal):
 1. distinct xs = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
unfolding distinct_count_atmost_1
[PROOF STATE]
proof (prove)
using this:
(count (mset xs) ?x2 = (if ?x2 \<in> set xs then 1 else 0)) = (count (mset xs) ?x2 \<le> 1)

goal (1 subgoal):
 1. (\<forall>a. count (mset xs) a = (if a \<in> set xs then 1 else 0)) = (\<forall>a. count (mset xs) a \<le> 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct xs = (\<forall>a. count (mset xs) a \<le> 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_over_sqrt :
  assumes detGreater0 : "SQ \<ge> 0"
  shows "(\<Sum>i\<in>{0..<n+1}. ((f i::real) * (SQ^(i div 2)) * real (i mod 2) * sqrt SQ +f i * SQ ^ (i div 2) * (1 - real (i mod 2))))
        =(\<Sum>i\<in>{0..<n+1}. ((f i::real) * ((sqrt SQ)^i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * SQ ^ (i div 2) * real (i mod 2) * sqrt SQ + f i * SQ ^ (i div 2) * (1 - real (i mod 2))) = (\<Sum>i = 0..<n + 1. f i * sqrt SQ ^ i)
[PROOF STEP]
apply (intro sum.cong refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n + 1} \<Longrightarrow> f x * SQ ^ (x div 2) * real (x mod 2) * sqrt SQ + f x * SQ ^ (x div 2) * (1 - real (x mod 2)) = f x * sqrt SQ ^ x
[PROOF STEP]
using sqrt_case[OF detGreater0] distrib_left mult.assoc
[PROOF STATE]
proof (prove)
using this:
SQ ^ (?i div 2) * real (?i mod 2) * sqrt SQ + SQ ^ (?i div 2) * (1 - real (?i mod 2)) = sqrt SQ ^ ?i
?a * (?b + ?c) = ?a * ?b + ?a * ?c
?a * ?b * ?c = ?a * (?b * ?c)

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n + 1} \<Longrightarrow> f x * SQ ^ (x div 2) * real (x mod 2) * sqrt SQ + f x * SQ ^ (x div 2) * (1 - real (x mod 2)) = f x * sqrt SQ ^ x
[PROOF STEP]
by metis


[STATEMENT]
lemma DERIV_real_sqrt: "0 < x \<Longrightarrow> DERIV sqrt x :> inverse (sqrt x) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> (sqrt has_real_derivative inverse (sqrt x) / 2) (at x)
[PROOF STEP]
using DERIV_real_sqrt_generic
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<noteq> 0; 0 < ?x \<Longrightarrow> ?D = inverse (sqrt ?x) / 2; ?x < 0 \<Longrightarrow> ?D = - inverse (sqrt ?x) / 2\<rbrakk> \<Longrightarrow> (sqrt has_real_derivative ?D) (at ?x)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> (sqrt has_real_derivative inverse (sqrt x) / 2) (at x)
[PROOF STEP]
by simp


[STATEMENT]
theorem (in ergodic_pmpt) birkhoff_sum_small_asymp_neg:
  fixes f::"'a \<Rightarrow> real"
  assumes [measurable]: "integrable M f" and "e>0"
  shows "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) - e .. n * (\<integral>x. f x \<partial>M)}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
have "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x - e .. n * real_cond_exp M Invariants f x}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
using birkhoff_sum_small_asymp_neg_nonergodic[OF assms]
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
have "AE x in M. real_cond_exp M Invariants f x = (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
using Invariants_cond_exp_is_integral[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f - e..real n * expectation f}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_sum4sq_int: "sum4sq_int(a,b,c,d) * sum4sq_int(p,q,r,s) =
  sum4sq_int(a*p+b*q+c*r+d*s, a*q-b*p-c*s+d*r,
         a*r+b*s-c*p-d*q, a*s-b*r+c*q-d*p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum4sq_int (a, b, c, d) * sum4sq_int (p, q, r, s) = sum4sq_int (a * p + b * q + c * r + d * s, a * q - b * p - c * s + d * r, a * r + b * s - c * p - d * q, a * s - b * r + c * q - d * p)
[PROOF STEP]
by (unfold sum4sq_int_def, simp add: eval_nat_numeral field_simps)


[STATEMENT]
lemma angle_altdef: "angle a b c = arccos ((a - b) \<bullet> (c - b) / (dist a b * dist c b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angle a b c = arccos ((a - b) \<bullet> (c - b) / (dist a b * dist c b))
[PROOF STEP]
by (simp add: angle_def vangle_def dist_norm)


[STATEMENT]
lemma ntt_coeffs_mult:
assumes "i<n"
shows "ntt_coeffs (f*g) !i = ntt_coeffs f! i * ntt_coeffs g ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ntt_coeffs (f * g) ! i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
unfolding ntt_coeffs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (ntt_coeff_poly (f * g)) [0..<n] ! i = map (ntt_coeff_poly f) [0..<n] ! i * map (ntt_coeff_poly g) [0..<n] ! i
[PROOF STEP]
using ntt_coeff_poly_mult[OF assms]
[PROOF STATE]
proof (prove)
using this:
ntt_coeff_poly (?f * ?g) i = ntt_coeff_poly ?f i * ntt_coeff_poly ?g i

goal (1 subgoal):
 1. map (ntt_coeff_poly (f * g)) [0..<n] ! i = map (ntt_coeff_poly f) [0..<n] ! i * map (ntt_coeff_poly g) [0..<n] ! i
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma consistent_eq_rank_ge:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  shows "consistent A b = (rank A \<ge> (if (\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0)
                                            then (to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistent A b = ((if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A)
[PROOF STEP]
using consistent_imp_rank_ge rank_ge_imp_consistent
[PROOF STATE]
proof (prove)
using this:
consistent ?A ?b \<Longrightarrow> (if \<exists>a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a)) + 1 else 0) \<le> rank ?A
(if \<exists>a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a)) + 1 else 0) \<le> rank ?A \<Longrightarrow> consistent ?A ?b

goal (1 subgoal):
 1. consistent A b = ((if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A)
[PROOF STEP]
by blast


[STATEMENT]
lemma of_nat_tendsto_top_ennreal: "(\<lambda>n::nat. of_nat n :: ennreal) \<longlonglongrightarrow> top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat \<longlonglongrightarrow> top
[PROOF STEP]
using LIMSEQ_SUP[of "of_nat :: nat \<Rightarrow> ennreal"]
[PROOF STATE]
proof (prove)
using this:
incseq of_nat \<Longrightarrow> of_nat \<longlonglongrightarrow> Sup (range of_nat)

goal (1 subgoal):
 1. of_nat \<longlonglongrightarrow> top
[PROOF STEP]
by (simp add: ennreal_SUP_of_nat_eq_top incseq_def)


[STATEMENT]
lemma has_integral_contour_integral_subpath:
  assumes "f contour_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "u \<le> v"
    shows "(((\<lambda>x. f(g x) * vector_derivative g (at x)))
            has_integral  contour_integral (subpath u v g) f) {u..v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
u \<le> v

goal (1 subgoal):
 1. ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>f contour_integrable_on g; valid_path g; u \<in> {0..1}; v \<in> {0..1}; u \<le> v\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
have "(\<lambda>r. f (g r) * vector_derivative g (at r)) integrable_on {u..v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. f (g r) * vector_derivative g (at r)) integrable_on {u..v}
[PROOF STEP]
by (metis (full_types) assms(1) assms(3) assms(4) atLeastAtMost_iff atLeastatMost_subset_iff contour_integrable_on integrable_on_subinterval)
[PROOF STATE]
proof (state)
this:
(\<lambda>r. f (g r) * vector_derivative g (at r)) integrable_on {u..v}

goal (1 subgoal):
 1. \<lbrakk>f contour_integrable_on g; valid_path g; u \<in> {0..1}; v \<in> {0..1}; u \<le> v\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>r. f (g r) * vector_derivative g (at r)) integrable_on {u..v}
[PROOF STEP]
have "((\<lambda>r. f (g r) * vector_derivative g (at r)) has_integral integral {u..v} (\<lambda>r. f (g r) * vector_derivative g (at r))) {u..v}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>r. f (g r) * vector_derivative g (at r)) integrable_on {u..v}

goal (1 subgoal):
 1. ((\<lambda>r. f (g r) * vector_derivative g (at r)) has_integral integral {u..v} (\<lambda>r. f (g r) * vector_derivative g (at r))) {u..v}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>r. f (g r) * vector_derivative g (at r)) has_integral integral {u..v} (\<lambda>r. f (g r) * vector_derivative g (at r))) {u..v}

goal (1 subgoal):
 1. \<lbrakk>f contour_integrable_on g; valid_path g; u \<in> {0..1}; v \<in> {0..1}; u \<le> v\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>r. f (g r) * vector_derivative g (at r)) has_integral integral {u..v} (\<lambda>r. f (g r) * vector_derivative g (at r))) {u..v}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>r. f (g r) * vector_derivative g (at r)) has_integral integral {u..v} (\<lambda>r. f (g r) * vector_derivative g (at r))) {u..v}

goal (1 subgoal):
 1. ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}
[PROOF STEP]
by (metis (full_types) assms contour_integral_unique has_contour_integral_subpath)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral contour_integral (subpath u v g) f) {u..v}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cramer_lemma_mat:
  assumes A: "A \<in> carrier_mat n n"
  and x: "x \<in> carrier_vec n"
  and k: "k < n"
shows "det (replace_col A (A *\<^sub>v x) k) = x $ k * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
define b where "b = A *\<^sub>v x"
[PROOF STATE]
proof (state)
this:
b = A *\<^sub>v x

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have b: "b \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> carrier_vec n
[PROOF STEP]
using A x
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
x \<in> carrier_vec n

goal (1 subgoal):
 1. b \<in> carrier_vec n
[PROOF STEP]
unfolding b_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
x \<in> carrier_vec n

goal (1 subgoal):
 1. A *\<^sub>v x \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> carrier_vec n

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
let ?Ab = "replace_col A b k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have Ab: "?Ab \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replace_col A b k \<in> carrier_mat n n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. replace_col A b k \<in> carrier_mat n n
[PROOF STEP]
by (auto simp: replace_col_def)
[PROOF STATE]
proof (state)
this:
replace_col A b k \<in> carrier_mat n n

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "x $ k * det A = (det A \<cdot>\<^sub>v x) $ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x $ k * det A = (det A \<cdot>\<^sub>v x) $ k
[PROOF STEP]
using A k x
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
k < n
x \<in> carrier_vec n

goal (1 subgoal):
 1. x $ k * det A = (det A \<cdot>\<^sub>v x) $ k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x $ k * det A = (det A \<cdot>\<^sub>v x) $ k

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x $ k * det A = (det A \<cdot>\<^sub>v x) $ k

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "det A \<cdot>\<^sub>v x = det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A \<cdot>\<^sub>v x = det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec n

goal (1 subgoal):
 1. det A \<cdot>\<^sub>v x = det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>v x = det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x)

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>v x = det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x)

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "\<dots> = (det A \<cdot>\<^sub>m 1\<^sub>m n) *\<^sub>v x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x) = det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x
[PROOF STEP]
using A x
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
x \<in> carrier_vec n

goal (1 subgoal):
 1. det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x) = det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x) = det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>v (1\<^sub>m n *\<^sub>v x) = det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "\<dots> = (adj_mat A * A) *\<^sub>v x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x = adj_mat A * A *\<^sub>v x
[PROOF STEP]
using adj_mat[OF A]
[PROOF STATE]
proof (prove)
using this:
adj_mat A \<in> carrier_mat n n
A * adj_mat A = det A \<cdot>\<^sub>m 1\<^sub>m n
adj_mat A * A = det A \<cdot>\<^sub>m 1\<^sub>m n

goal (1 subgoal):
 1. det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x = adj_mat A * A *\<^sub>v x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x = adj_mat A * A *\<^sub>v x

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A \<cdot>\<^sub>m 1\<^sub>m n *\<^sub>v x = adj_mat A * A *\<^sub>v x

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "\<dots> = adj_mat A *\<^sub>v b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adj_mat A * A *\<^sub>v x = adj_mat A *\<^sub>v b
[PROOF STEP]
using adj_mat[OF A] A x
[PROOF STATE]
proof (prove)
using this:
adj_mat A \<in> carrier_mat n n
A * adj_mat A = det A \<cdot>\<^sub>m 1\<^sub>m n
adj_mat A * A = det A \<cdot>\<^sub>m 1\<^sub>m n
A \<in> carrier_mat n n
x \<in> carrier_vec n

goal (1 subgoal):
 1. adj_mat A * A *\<^sub>v x = adj_mat A *\<^sub>v b
[PROOF STEP]
unfolding b_def
[PROOF STATE]
proof (prove)
using this:
adj_mat A \<in> carrier_mat n n
A * adj_mat A = det A \<cdot>\<^sub>m 1\<^sub>m n
adj_mat A * A = det A \<cdot>\<^sub>m 1\<^sub>m n
A \<in> carrier_mat n n
x \<in> carrier_vec n

goal (1 subgoal):
 1. adj_mat A * A *\<^sub>v x = adj_mat A *\<^sub>v (A *\<^sub>v x)
[PROOF STEP]
by (metis assoc_mult_mat_vec)
[PROOF STATE]
proof (state)
this:
adj_mat A * A *\<^sub>v x = adj_mat A *\<^sub>v b

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
adj_mat A * A *\<^sub>v x = adj_mat A *\<^sub>v b

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "\<dots> $ k = row (adj_mat A) k \<bullet> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (adj_mat A *\<^sub>v b) $ k = row (adj_mat A) k \<bullet> b
[PROOF STEP]
using adj_mat[OF A] b k
[PROOF STATE]
proof (prove)
using this:
adj_mat A \<in> carrier_mat n n
A * adj_mat A = det A \<cdot>\<^sub>m 1\<^sub>m n
adj_mat A * A = det A \<cdot>\<^sub>m 1\<^sub>m n
b \<in> carrier_vec n
k < n

goal (1 subgoal):
 1. (adj_mat A *\<^sub>v b) $ k = row (adj_mat A) k \<bullet> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(adj_mat A *\<^sub>v b) $ k = row (adj_mat A) k \<bullet> b

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(adj_mat A *\<^sub>v b) $ k = row (adj_mat A) k \<bullet> b

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
have "\<dots> = det (replace_col A b k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (adj_mat A) k \<bullet> b = det (replace_col A b k)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec b. row (adj_mat A) k $ i * b $ i) = det (replace_col A b k)
[PROOF STEP]
using b k A
[PROOF STATE]
proof (prove)
using this:
b \<in> carrier_vec n
k < n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec b. row (adj_mat A) k $ i * b $ i) = det (replace_col A b k)
[PROOF STEP]
by (subst laplace_expansion_column[OF Ab k], auto intro!: sum.cong arg_cong[of _ _ det]
      arg_cong[of _ _ "\<lambda> x. _ * x"] eq_matI
      simp: replace_col_def adj_mat_def Matrix.row_def cofactor_def mat_delete_def ac_simps)
[PROOF STATE]
proof (state)
this:
row (adj_mat A) k \<bullet> b = det (replace_col A b k)

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x $ k * det A = det (replace_col A b k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x $ k * det A = det (replace_col A b k)

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
unfolding b_def
[PROOF STATE]
proof (prove)
using this:
x $ k * det A = det (replace_col A (A *\<^sub>v x) k)

goal (1 subgoal):
 1. det (replace_col A (A *\<^sub>v x) k) = x $ k * det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (replace_col A (A *\<^sub>v x) k) = x $ k * det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_n_n [simp]: "n choose n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose n = 1
[PROOF STEP]
by (induct n) (simp_all add: binomial_eq_0)


[STATEMENT]
lemma arsinh_real_aux: "0 < x + sqrt (x ^ 2 + 1 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
proof (cases "x < 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < 0

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
have "(-x) ^ 2 = x ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x)\<^sup>2 = x\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- x)\<^sup>2 = x\<^sup>2

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- x)\<^sup>2 = x\<^sup>2

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
have "x ^ 2 < x ^ 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 < x\<^sup>2 + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x\<^sup>2 < x\<^sup>2 + 1

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- x)\<^sup>2 < x\<^sup>2 + 1
[PROOF STEP]
have "sqrt ((-x) ^ 2) < sqrt (x ^ 2 + 1)"
[PROOF STATE]
proof (prove)
using this:
(- x)\<^sup>2 < x\<^sup>2 + 1

goal (1 subgoal):
 1. sqrt ((- x)\<^sup>2) < sqrt (x\<^sup>2 + 1)
[PROOF STEP]
by (rule real_sqrt_less_mono)
[PROOF STATE]
proof (state)
this:
sqrt ((- x)\<^sup>2) < sqrt (x\<^sup>2 + 1)

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
 2. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt ((- x)\<^sup>2) < sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
sqrt ((- x)\<^sup>2) < sqrt (x\<^sup>2 + 1)
x < 0

goal (1 subgoal):
 1. 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. \<not> x < 0 \<Longrightarrow> 0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
qed (auto simp: add_nonneg_pos)


[STATEMENT]
lemma add_mod:
  fixes p q :: int
  assumes "p mod 2 = 0" "q mod 2 = 0"
  shows "(p+q) mod 2 = 0 \<and> (p-q) mod 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p + q) mod 2 = 0 \<and> (p - q) mod 2 = 0
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
p mod 2 = 0
q mod 2 = 0

goal (1 subgoal):
 1. (p + q) mod 2 = 0 \<and> (p - q) mod 2 = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma lookup_other_ev_Some: assumes "lookup_other_ev ev k A = Some i"
  shows "i < k \<and> A $$ (i,i) \<noteq> ev \<and> (\<forall> j. i < j \<and> j < k \<longrightarrow> A $$ (j,j) = ev)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < k \<and> A $$ (i, i) \<noteq> ev \<and> (\<forall>j. i < j \<and> j < k \<longrightarrow> A $$ (j, j) = ev)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lookup_other_ev ev k A = Some i

goal (1 subgoal):
 1. i < k \<and> A $$ (i, i) \<noteq> ev \<and> (\<forall>j. i < j \<and> j < k \<longrightarrow> A $$ (j, j) = ev)
[PROOF STEP]
by (induct ev k A rule: lookup_other_ev.induct, auto split: if_splits)
  (insert less_SucE, blast)


[STATEMENT]
lemma DERIV_isconst_end:
  fixes f :: "real \<Rightarrow> real"
  assumes "a < b" and contf: "continuous_on {a..b} f"
    and 0: "\<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> DERIV f x :> 0"
  shows "f b = f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b = f a
[PROOF STEP]
using MVT [OF \<open>a < b\<close>] "0" DERIV_unique contf real_differentiable_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on {a..b} ?f; \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> ?f differentiable at x\<rbrakk> \<Longrightarrow> \<exists>l z. a < z \<and> z < b \<and> (?f has_real_derivative l) (at z) \<and> ?f b - ?f a = (b - a) * l
\<lbrakk>a < ?x; ?x < b\<rbrakk> \<Longrightarrow> (f has_real_derivative 0) (at ?x)
\<lbrakk>(?f has_field_derivative ?D) (at ?x); (?f has_field_derivative ?E) (at ?x)\<rbrakk> \<Longrightarrow> ?D = ?E
continuous_on {a..b} f
(?f differentiable at ?x within ?s) = (\<exists>D. (?f has_real_derivative D) (at ?x within ?s))

goal (1 subgoal):
 1. f b = f a
[PROOF STEP]
by (fastforce simp: algebra_simps)


[STATEMENT]
lemma continuous_at_within_sgn[continuous_intros]:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
  assumes "continuous (at a within s) f"
    and "f a \<noteq> 0"
  shows "continuous (at a within s) (\<lambda>x. sgn (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. sgn (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous (at a within s) f
f a \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. sgn (f x))
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f a) (at a within s)
f a \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. sgn (f x)) \<longlongrightarrow> sgn (f a)) (at a within s)
[PROOF STEP]
by (rule tendsto_sgn)


[STATEMENT]
lemma prime_factorization_primorial:
  "prime_factorization (primorial x) = mset_set {p. prime p \<and> real p \<le> x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (primorial x) = mset_set {p. prime p \<and> real p \<le> x}
[PROOF STEP]
proof (intro multiset_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. count (prime_factorization (primorial x)) xa = count (mset_set {p. prime p \<and> real p \<le> x}) xa
[PROOF STEP]
fix p :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. count (prime_factorization (primorial x)) xa = count (mset_set {p. prime p \<and> real p \<le> x}) xa
[PROOF STEP]
note fin = finite_primes_le[of x]
[PROOF STATE]
proof (state)
this:
finite {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. \<And>xa. count (prime_factorization (primorial x)) xa = count (mset_set {p. prime p \<and> real p \<le> x}) xa
[PROOF STEP]
show "count (prime_factorization (primorial x)) p =
          count (mset_set {p. prime p \<and> real p \<le> x}) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
proof (cases "prime p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
prime p

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
hence "count (prime_factorization (primorial x)) p =
             sum (multiplicity p) {p. prime p \<and> real p \<le> x}"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. count (prime_factorization (primorial x)) p = sum (multiplicity p) {p. prime p \<and> real p \<le> x}
[PROOF STEP]
unfolding primorial_def count_prime_factorization
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (if prime p then multiplicity p (\<Prod>{p. prime p \<and> real p \<le> x}) else 0) = sum (multiplicity p) {p. prime p \<and> real p \<le> x}
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
prime p
finite {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. (if prime p then multiplicity p (\<Prod>{p. prime p \<and> real p \<le> x}) else 0) = sum (multiplicity p) {p. prime p \<and> real p \<le> x}
[PROOF STEP]
by (subst prime_elem_multiplicity_prod_distrib) auto
[PROOF STATE]
proof (state)
this:
count (prime_factorization (primorial x)) p = sum (multiplicity p) {p. prime p \<and> real p \<le> x}

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count (prime_factorization (primorial x)) p = sum (multiplicity p) {p. prime p \<and> real p \<le> x}

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "\<dots> = sum (\<lambda>_. 1) (if p \<le> x then {p} else {})"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. sum (multiplicity p) {p. prime p \<and> real p \<le> x} = (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1)
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
prime p
finite {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. sum (multiplicity p) {p. prime p \<and> real p \<le> x} = (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1)
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: prime_multiplicity_other split: if_splits)
[PROOF STATE]
proof (state)
this:
sum (multiplicity p) {p. prime p \<and> real p \<le> x} = (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1)

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (multiplicity p) {p. prime p \<and> real p \<le> x} = (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1)

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
have "\<dots> = count (mset_set {p. prime p \<and> real p \<le> x}) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1) = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
using True fin
[PROOF STATE]
proof (prove)
using this:
prime p
finite {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. (\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1) = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>(if real p \<le> x then {p} else {}). 1) = count (mset_set {p. prime p \<and> real p \<le> x}) p

goal (2 subgoals):
 1. prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
 2. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p

goal (1 subgoal):
 1. count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
count (prime_factorization (primorial x)) p = count (mset_set {p. prime p \<and> real p \<le> x}) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma glb_dual_lub: "glb S cl = lub S (dual cl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. glb S cl = lub S (dual cl)
[PROOF STEP]
by (simp add: lub_def glb_def least_def greatest_def dual_def converse_unfold)


[STATEMENT]
lemma from_nat_suc:
shows "from_nat (j + 1) = from_nat j + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (j + 1) = mod_type_class.from_nat j + (1::'a)
[PROOF STEP]
unfolding from_nat_def o_def Abs'_def add_def' Rep_1 Rep_Abs_mod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs (int (j + 1) mod int CARD('a)) = Abs ((int j mod int CARD('a) + 1) mod int CARD('a))
[PROOF STEP]
unfolding of_nat_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs ((int j + int 1) mod int CARD('a)) = Abs ((int j mod int CARD('a) + 1) mod int CARD('a))
[PROOF STEP]
apply (subst mod_add_left_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs ((int j + int 1) mod int CARD('a)) = Abs ((int j + 1) mod int CARD('a))
[PROOF STEP]
unfolding of_nat_1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs ((int j + 1) mod int CARD('a)) = Abs ((int j + 1) mod int CARD('a))
[PROOF STEP]
..


[STATEMENT]
lemma mod_mod:
  fixes x a b :: nat
  shows "x mod 2^a mod 2^b = x mod 2^(min a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod 2 ^ a mod 2 ^ b = x mod 2 ^ min a b
[PROOF STEP]
by (metis min.commute take_bit_eq_mod take_bit_take_bit)


[STATEMENT]
lemma transpose_mat_of_rows: "(mat_of_rows n vs)\<^sup>T = mat_of_cols n vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_rows n vs)\<^sup>T = mat_of_cols n vs
[PROOF STEP]
by (auto intro!: eq_matI simp: mat_of_rows_index mat_of_cols_index)


[STATEMENT]
lemma is_suffix_eq_proper_suffix: "is_suffix a b = (a = b \<or> is_proper_suffix a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_suffix a b = (a = b \<or> is_proper_suffix a b)
[PROOF STEP]
by (metis append_Nil is_proper_suffix_def is_suffix_def)


[STATEMENT]
lemma nat_of_digit_digit_of_nat_id:
    \<open>x < 10 \<Longrightarrow> nat_of_digit (digit_of_nat x) = x\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < 10 \<Longrightarrow> nat_of_digit (digit_of_nat x) = x
[PROOF STEP]
by(simp add:nat_of_digit_def digit_of_nat_def)


[STATEMENT]
lemma nn_integral_lborel_prod:
  assumes [measurable]: "\<And>b. b \<in> Basis \<Longrightarrow> f b \<in> borel_measurable borel"
  assumes nn[simp]: "\<And>b x. b \<in> Basis \<Longrightarrow> 0 \<le> f b x"
  shows "(\<integral>\<^sup>+x. (\<Prod>b\<in>Basis. f b (x \<bullet> b)) \<partial>lborel) = (\<Prod>b\<in>Basis. (\<integral>\<^sup>+x. f b x \<partial>lborel))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Prod>b\<in>Basis. f b (x \<bullet> b)) \<partial>lborel = (\<Prod>b\<in>Basis. integral\<^sup>N lborel (f b))
[PROOF STEP]
by (simp add: lborel_def nn_integral_distr product_nn_integral_prod
                product_nn_integral_singleton)


[STATEMENT]
lemma length_fv_fo_fmla_list: "length (fv_fo_fmla_list \<phi>) = card (fv_fo_fmla \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (fv_fo_fmla_list \<phi>) = card (fv_fo_fmla \<phi>)
[PROOF STEP]
using fv_fo_fmla_list_set[of \<phi>] sorted_distinct_fv_list[of \<phi>]
    distinct_card[of "fv_fo_fmla_list \<phi>"]
[PROOF STATE]
proof (prove)
using this:
set (fv_fo_fmla_list \<phi>) = fv_fo_fmla \<phi>
sorted_distinct (fv_fo_fmla_list \<phi>)
distinct (fv_fo_fmla_list \<phi>) \<Longrightarrow> card (set (fv_fo_fmla_list \<phi>)) = length (fv_fo_fmla_list \<phi>)

goal (1 subgoal):
 1. length (fv_fo_fmla_list \<phi>) = card (fv_fo_fmla \<phi>)
[PROOF STEP]
by auto


[STATEMENT]
lemma refl_trans_closure_subset_of_refl_symm_trans_closure:
  fixes Rel :: "('a \<times> 'a) set"
  shows "Rel\<^sup>* \<subseteq> (symcl (Rel\<^sup>=))\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rel\<^sup>* \<subseteq> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> Rel\<^sup>* \<Longrightarrow> (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> Rel\<^sup>* \<Longrightarrow> (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
assume "(a, b) \<in> Rel\<^sup>*"
[PROOF STATE]
proof (state)
this:
(a, b) \<in> Rel\<^sup>*

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> Rel\<^sup>* \<Longrightarrow> (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
hence "(a, b) \<in> (symcl Rel)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> Rel\<^sup>*

goal (1 subgoal):
 1. (a, b) \<in> (symcl Rel)\<^sup>*
[PROOF STEP]
using in_rtrancl_UnI[of "(a, b)" "Rel" "Rel\<inverse>"]
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> Rel\<^sup>*
(a, b) \<in> Rel\<^sup>* \<or> (a, b) \<in> (Rel\<inverse>)\<^sup>* \<Longrightarrow> (a, b) \<in> (Rel \<union> Rel\<inverse>)\<^sup>*

goal (1 subgoal):
 1. (a, b) \<in> (symcl Rel)\<^sup>*
[PROOF STEP]
by (simp add: symcl_def)
[PROOF STATE]
proof (state)
this:
(a, b) \<in> (symcl Rel)\<^sup>*

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> Rel\<^sup>* \<Longrightarrow> (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
thus "(a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> (symcl Rel)\<^sup>*

goal (1 subgoal):
 1. (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
using refl_symm_trans_closure_is_symm_refl_trans_closure[of Rel]
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> (symcl Rel)\<^sup>*
(symcl (Rel\<^sup>=))\<^sup>+ = (symcl Rel)\<^sup>*

goal (1 subgoal):
 1. (a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(a, b) \<in> (symcl (Rel\<^sup>=))\<^sup>+

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma join_restrict_table:
  assumes "table n A X" "table n B Y" "\<not> b \<Longrightarrow> B \<subseteq> A"
  shows "v \<in> join X b Y \<longleftrightarrow>
    wf_tuple n (A \<union> B) v \<and> restrict A v \<in> X \<and> (if b then restrict B v \<in> Y else restrict B v \<notin> Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<in> join X b Y) = (wf_tuple n (A \<union> B) v \<and> restrict A v \<in> X \<and> (if b then restrict B v \<in> Y else restrict B v \<notin> Y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
table n A X
table n B Y
\<not> b \<Longrightarrow> B \<subseteq> A

goal (1 subgoal):
 1. (v \<in> join X b Y) = (wf_tuple n (A \<union> B) v \<and> restrict A v \<in> X \<and> (if b then restrict B v \<in> Y else restrict B v \<notin> Y))
[PROOF STEP]
unfolding table_def
[PROOF STATE]
proof (prove)
using this:
Ball X (wf_tuple n A)
Ball Y (wf_tuple n B)
\<not> b \<Longrightarrow> B \<subseteq> A

goal (1 subgoal):
 1. (v \<in> join X b Y) = (wf_tuple n (A \<union> B) v \<and> restrict A v \<in> X \<and> (if b then restrict B v \<in> Y else restrict B v \<notin> Y))
[PROOF STEP]
by (simp add: join_restrict)


[STATEMENT]
lemma pigeonhole:
assumes
  finitA: "finite A" and
  Bss: "B \<subseteq> A" and Css: "C \<subseteq> A" and
  cardH: "card A + k <= card B + card C"
shows "k <= card (B \<inter> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
from Bss Css
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> A
C \<subseteq> A
[PROOF STEP]
have "B \<union> C \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
C \<subseteq> A

goal (1 subgoal):
 1. B \<union> C \<subseteq> A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B \<union> C \<subseteq> A

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
with finitA
[PROOF STATE]
proof (chain)
picking this:
finite A
B \<union> C \<subseteq> A
[PROOF STEP]
have "card (B \<union> C) <= card A"
[PROOF STATE]
proof (prove)
using this:
finite A
B \<union> C \<subseteq> A

goal (1 subgoal):
 1. card (B \<union> C) \<le> card A
[PROOF STEP]
by (simp add: card_mono)
[PROOF STATE]
proof (state)
this:
card (B \<union> C) \<le> card A

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
with cardH
[PROOF STATE]
proof (chain)
picking this:
card A + k \<le> card B + card C
card (B \<union> C) \<le> card A
[PROOF STEP]
have
      h: "k <= card B + card C - card (B \<union> C)"
[PROOF STATE]
proof (prove)
using this:
card A + k \<le> card B + card C
card (B \<union> C) \<le> card A

goal (1 subgoal):
 1. k \<le> card B + card C - card (B \<union> C)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
k \<le> card B + card C - card (B \<union> C)

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
from finitA Bss Css and finite_subset
[PROOF STATE]
proof (chain)
picking this:
finite A
B \<subseteq> A
C \<subseteq> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
[PROOF STEP]
have "finite B \<and> finite C"
[PROOF STATE]
proof (prove)
using this:
finite A
B \<subseteq> A
C \<subseteq> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite B \<and> finite C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite B \<and> finite C

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite B \<and> finite C

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
using card_Un_Int and h
[PROOF STATE]
proof (prove)
using this:
finite B \<and> finite C
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> card ?A + card ?B = card (?A \<union> ?B) + card (?A \<inter> ?B)
k \<le> card B + card C - card (B \<union> C)

goal (1 subgoal):
 1. k \<le> card (B \<inter> C)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
k \<le> card (B \<inter> C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_vec_dims:
  assumes "split_i_j_x i j x = (a ,b)"
  shows "dim_vec a = i" "dim_vec b = (j - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec a = i &&& dim_vec b = j - i
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
split_i_j_x i j x = (a, b)

goal (1 subgoal):
 1. dim_vec a = i &&& dim_vec b = j - i
[PROOF STEP]
unfolding split_i_j_x_def
[PROOF STATE]
proof (prove)
using this:
(vec i \<langle>x\<rangle>, vec (j - i) (\<lambda>y. \<langle>x\<rangle> (y + i))) = (a, b)

goal (1 subgoal):
 1. dim_vec a = i &&& dim_vec b = j - i
[PROOF STEP]
by auto+


[STATEMENT]
lemma path_image_linepath[simp]: "path_image (linepath a b) = closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (linepath a b) = closed_segment a b
[PROOF STEP]
unfolding path_image_def segment linepath_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1 - x) *\<^sub>R a + x *\<^sub>R b) ` {0..1} = {(1 - u) *\<^sub>R a + u *\<^sub>R b |u. 0 \<le> u \<and> u \<le> 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma pow_res_of_zero:
  shows "pow_res n \<zero> = {\<zero>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_res n \<zero> = {\<zero>}
[PROOF STEP]
unfolding pow_res_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n} = {\<zero>}
[PROOF STEP]
apply(rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n} \<subseteq> {\<zero>}
 2. {\<zero>} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n}
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n} \<Longrightarrow> x \<in> {\<zero>}
 2. {\<zero>} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n}
[PROOF STEP]
unfolding mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. x = \<zero> \<otimes> y [^] n) \<Longrightarrow> x \<in> {\<zero>}
 2. {\<zero>} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n}
[PROOF STEP]
apply (metis Qp.integral_iff Qp.nat_pow_closed Qp.nonzero_closed Qp.zero_closed insertCI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<zero>} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n}
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<zero>} \<Longrightarrow> x \<in> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = \<zero> \<otimes> y [^] n}
[PROOF STEP]
unfolding mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<zero>} \<Longrightarrow> x \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. x = \<zero> \<otimes> y [^] n)
[PROOF STEP]
by (metis Qp.nat_pow_one Qp.one_nonzero Qp.r_one Qp.zero_closed equals0D insertE)


[STATEMENT]
lemma continuous_on_closed_Collect_le:
  fixes f g :: "'a::topological_space \<Rightarrow> real"
  assumes f: "continuous_on s f" and g: "continuous_on s g" and s: "closed s"
  shows "closed {x \<in> s. f x \<le> g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
have "closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)
[PROOF STEP]
using closed_real_atLeast continuous_on_diff [OF g f]
[PROOF STATE]
proof (prove)
using this:
closed {?a..}
continuous_on s (\<lambda>x. g x - f x)

goal (1 subgoal):
 1. closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)
[PROOF STEP]
by (simp add: continuous_on_closed_vimage [OF s])
[PROOF STATE]
proof (state)
this:
closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)

goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)

goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
have "((\<lambda>x. g x - f x) -` {0..} \<inter> s) = {x\<in>s. f x \<le> g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g x - f x) -` {0..} \<inter> s = {x \<in> s. f x \<le> g x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x - f x) -` {0..} \<inter> s = {x \<in> s. f x \<le> g x}

goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed {x \<in> s. f x \<le> g x}

goal (1 subgoal):
 1. closed {x \<in> s. f x \<le> g x}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
closed {x \<in> s. f x \<le> g x}

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
lemma  matrix_right_invertible:
  "linear f \<Longrightarrow> ((\<exists>B. matrix f ** B = mat 1) \<longleftrightarrow> (\<exists>g. linear g \<and> f \<circ> g = id))" for f::"real^'m \<Rightarrow> real^'n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear f \<Longrightarrow> (\<exists>B. matrix f ** B = mat 1) = (\<exists>g. linear g \<and> f \<circ> g = id)
[PROOF STEP]
using matrix_right_invertible_gen[of f]
[PROOF STATE]
proof (prove)
using this:
Vector_Spaces.linear (*s) (*s) f \<Longrightarrow> (\<exists>B. matrix f ** B = mat 1) = (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id)

goal (1 subgoal):
 1. linear f \<Longrightarrow> (\<exists>B. matrix f ** B = mat 1) = (\<exists>g. linear g \<and> f \<circ> g = id)
[PROOF STEP]
by (auto simp: linear_matrix_vector_mul_eq)


[STATEMENT]
theorem "\<And>(y::int) (z::int) (n::int). 3 dvd z \<Longrightarrow> 2 dvd (y::int) \<Longrightarrow>
  (\<exists>(x::int). 2*x = y) \<and> (\<exists>(k::int). 3*k = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z n. \<lbrakk>3 dvd z; even y\<rbrakk> \<Longrightarrow> (\<exists>x. 2 * x = y) \<and> (\<exists>k. 3 * k = z)
[PROOF STEP]
by cooper